Robocopy – Copying files with file permissions (ACLs) and Importing file permissions / security information

If you have a file server in your corporate environment and want to move all files to another location with all security information / file permissions  (ACLs), you can use robocopy, a built-in tool which can be called simply from a command prompt of a Windows Server 2008 or Windows 7 installed computer.

If you want to copy all the files into the new file server by keeping directory tree as it is and security information / file permissions, you can simply use the following command to achieve that;

robocopy “source address” “destination address” *.* /mir /sec

If you have copied the files before with another tool or technique but without any file permissions or security information (ACLs), you can fix the security information of each file and add file permissions using the following command;

robocopy “source address” “destination address” *.* /mir /secfix /sec

Using the command above, you don’t need to copy all files again or try to write a script to add access control list to each file, robocopy will read the file permissions from the existing directory tree and add the security information to each file in the new location.

This entry was posted in Windows Security and tagged , , , , , , , , , . Bookmark the permalink.

3 Responses to Robocopy – Copying files with file permissions (ACLs) and Importing file permissions / security information

  1. Francis Soen says:

    Your article is the first one that shows how to use the /secfix flag properly. All other articles mention /secfix but not /sec and I always ended up with an error message.

  2. Chien Nguyen says:

    Francis Soen is correct. Microsoft website even suggested about using /xc, …. BUT it does not works.

    Thanks

  3. baybars says:

    You don’t actually seem to need “/sec” to keep permissions. “/mir” alone works just fine.

Leave a Reply

Your email address will not be published. Required fields are marked *