How to compare/diff recursively owner and group of directories?

David Christensen dpchrist at holgerdanske.com
Sun Jan 11 20:54:00 UTC 2015


On 01/11/2015 04:47 AM, Unknown Crewman wrote:
> any idea how to check recursively, if the owner and group of a directory and it's content differs to an directory and it's content from a backup?
> I made a mistake and it's unlikely that owner and group of any file or directory changed, but it's not impossible, so I want to compare everything with a backup directory.
> diff/find?

One idea would be a shell one-liner pipeline using find, sort, xargs, 
stat, and/or cut, run once for each tree, put the output into text 
files, and then diff the text files.  Here's an StackExchange thread 
that discusses sorting in the face of filenames containing spaces:

http://unix.stackexchange.com/questions/34325/sorting-the-output-of-find


Another option is Perl.  Here is a Perl script I wrote to compare mtime 
and size of files in two trees.  You could hack it up to check uid and 
gid for directories and files:

dirdiff.cvs.sourceforge.net/viewvc/dirdiff/dirdiff/dirdiff.pl


HTH,

David



More information about the D-community-offtopic mailing list