Return to Snippet

Revision: 19521
at October 25, 2009 12:23 by deepsoul

Initial Code
# First copy files themselves, with timestamps:
cp -a folder1 folder2

# Set all ACLs of copies to ACLs of originals:
cd folder2
find . | while read f ; do getfacl ../folder1/"$f" | setfacl -f - "$f" ; done

# or when permissions are equal for all files / directories:
getfacl folder1 > folder-perms
getfacl folder1/file > file-perms
find folder2 -type d -exec setfacl -f folder-perms '{}' \;
find folder2 -type f -exec setfacl -f file-perms '{}' \;
# or probably faster:
find folder2 -type d -print0 | xargs -0 setfacl -f folder-perms
find folder2 -type f -print0 | xargs -0 setfacl -f file-perms

Initial URL

Initial Description
Cygwin's `cp` discards ACLs (complex windoze permissions).  You have to copy them separately as follows:

Initial Title
Cygwin: recursive copy with ACLs

Initial Tags

Initial Language