Copy NTFS permissions only and no data from source to target

This is how a colleague (John) and I at work managed to copy only permissions for files from a source to target folder. Each directory containing the exact same files. What happened, somebody copied the files to a new location but didn’t copy permissions at the same time, so we did this step at the end as a final step instead.

At first we spent several long hours using Ropycopy, but this didn’t work and we eventually gave up. We tried the following robocopy commands:

robocopy "\\<servername>\OLD_Information\T-E-S-T" “\\<servername>\Information\T-E-S-T” /e /secfix /copyall /xo /xn /xc /r:2 /w:1 /LOG+:c:\Log1.log /TEE

robocopy "\\<servername>\OLD_Information\T-E-S-T" "\\<servername>\Information\T-E-S-T" /e /IS /COPY:SOU /r:2 /w:1 /LOG+:c:\T-E-S-T.log /TEE

Both of these robocopy commands above didn’t seem to work even after we triple and quadruple checked everything. So we gave up and used icacls instead. With extensive testing and only two commands later, icacls successfully copied over all NTFS permissions.

icacls "\\<servername>\Information\T-E-S-T" /save C:\ACL_info_file /T
icacls "\\<servername>\Information" /restore C:\ACL_info_file

Notice that as part of the restore process we left out the last folder level with no back slash? This is because this folder level is included in the ACL info file. If you open up the ACL info file in notepad, each line starts with T-E-S-T\…     When the restore is run, it adds this to the end of the location specified in the restore command. This is also handy if the target path is named differently, you can do a ‘replace all’ in the ACL info file.

5 Comments

  1. Bob Stockwell

    Perfect! well, nearly. I can edit the saved txt file and substitute the folder name I want to have the permissions

  2. Thanks! Just what I was looking for

  3. My output does not include the folder level, so I’m unable to replace the target path, which is what I need to do.

  4. Use : robocopy origin destination /secfix /xo /xn /xc

  5. This just saved me. Thank you!

Leave a Reply to Claudio Ionfrida Cancel reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s