Is there a command that produces a diff of the permissions of target files?

Just as it sounds, I'm trying to find out if there is a (standard) command that will produce a diff of the permissions between two files and/or directory trees.

Ideally it would put out a patch file that could be used to change permissions to match the target, though I'm guessing since standard patch files are interpreted by ed, that it might have to be a separate format.


Solution 1:

You could always do something like this to get the differences.

diff -u <( cd path1 ; find . -printf "chown %U:%G %p; chmod %m %p \n" | sort ) \
        <( cd path2 ; find . -printf "chown %U:%G %p; chmod %m %p \n" | sort )

It would then be trivial to hack up something that performs the require changes.