Unix Shell - Re: Identifying if object {filename|directoryname} is file or directory when using dif

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > October 2006 > Re: Identifying if object {filename|directoryname} is file or directory when using dif





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: Identifying if object {filename|directoryname} is file or directory when using dif
Dundonald

2006-10-19, 1:21 pm


Dundonald wrote:

> Thanks to Jon in response to my post Comparing Directory Structures I
> have managed to tidy up my own solution by using
>
> diff -sqdr <directory1> <directory2>
>
> which returns with lines to the effect of
>
> Only in {d1|d2}: {filename|directoryname}
>
> Files d1/{filename|directoryname} and d2/{filename|directoryname}
> {differ|are identical}
>
> I do a grep -v "are identical" so I only receive the differences back.
> But what I'm keep to find out is if it's possible that the diff command
> can tell me if in the same return if the object that is different is a
> file or a directory.
>
> Thanks


Apologies, I neglected to include an example. If d1 and d2 are exactly
the same but I add another directory underneath d2 called "test" then
diff -sqrd d1 d2 would return the following:

Only in d2: "test"

If I then add a file called "testfile" underneath d2 then diff -sqrd d1
d2 would return the following:

Only in d2: "test"
Only in d2: "testfile"

>From the result it's not possible to identify whether the object is a

file or a directory (please ignore the fact that I have put "file" in
the filename!).

Any ideas appreciated.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com