Are there any ways in OS X to clone the permissions of one folder to another. Just to be clear, I don't want to copy the entire folder, just the permissions and then set them on another folder. I think this type of thing could be achieved on Linux/UNIX using the setfacl/getfacl commands, but I'm unsure on how to do this with OS X.
Thanks
Tested on Mac OS X v10.5.7, in bash:
chown $(stat -f%u:%g "$srcdir") "$dstdir" # Copy owner and group
chmod $(stat -f%Mp%Lp "$srcdir") "$dstdir" # Copy the mode bits
(ls -lde "$srcdir" | tail +2 | sed 's/^ [0-9]*: //'; echo) | chmod -E "$dstdir" # Copy the ACL
Notes: These operations (esp. changing ownership) are likely to require root access; sprinkle with sudo
for best results. Also, that odd echo
command on the last line is there to prevent an error if srcdir doesn't have any ACL entries attached (chmod -E
can cope with blank lines, but not a completely empty input).
I presume you Googled and found at least:
And this web page also seems to cover some important information (such as fsaclctl
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With