Reputation: 943
There are identical folders with almost the same content/structure from two different machines but the permissions are different.
How can I copy all permissions from folder A to folder B recursively to trickle down to all subfolders and files with same name and skip anything that is not.
There is a command, for example:
chown --reference=otherfile thisfile
Is there a way to make it recursive or maybe any other way?
Thanks.
Upvotes: 0
Views: 350
Reputation: 6178
There may be a way to do this in the -exec
part of find, but this works:
for file in $( find . -mindepth 1 ); do
getfacl ${otherdir}/${file} | setfacl --set-file=- ${file}
done
It will copy ALL of the permissions, including Access Control Lists.
Upvotes: 1