Alic
Alic

Reputation: 41

How to copy folder permissions by robocopy?

I used robocopy like this:

robocopy D:\123 D:\456 /e /copyall

than I changed the permissions of folder D:\123(change ACL,include all files and subfolders), I want to copy the new permissions of folder D:\123 to folder D:\456(include all files and subfolders). so I used robocopy like this:

"robocopy D:\123 D:\456 /e /copy:sao"

Update permissions(ACL) for all files succeeded,but the permissions(ACL) of the folder update failed,the permissions of all folder is not changed. How can I update the permissions(ACL) of folders?

Upvotes: 4

Views: 15577

Answers (1)

gavioto
gavioto

Reputation: 1745

You can find complete information about why coping folder permissions can't work when there's no modifications in files and folders and why permissions on files are not copied in older versions of Robocopy.

https://techcommunity.microsoft.com/t5/storage-at-microsoft/robocopy-mir-switch-8211-mirroring-file-permissions/ba-p/423662

When I wrote the “security copy” part of Robocopy on 22 May 1997, I chose to do this for performance reasons, to keep Robocopy times for large trees down. This was an adequate implementation for most peoples’ needs at the time. Also, another reason I chose to do things the way I did, is that setting security on directories is sufficient for most people. Setting security on a file-by-file basis is a more granular approach, for sure, but incurs a larger maintenance overhead, perhaps too much for many users.

Try to use this command to maintain two folder in sync including security information (ACL)

So, to maintain two trees in sync, including their security, using Vista’s Robocopy, you can use the following as your regular Robocopy command:

ROBOCOPY <source> <target> /MIR /SEC /SECFIX

Upvotes: 2

Related Questions