| 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.
|