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.
Perfect! well, nearly. I can edit the saved txt file and substitute the folder name I want to have the permissions
Thanks! Just what I was looking for
My output does not include the folder level, so I’m unable to replace the target path, which is what I need to do.
Use : robocopy origin destination /secfix /xo /xn /xc
This just saved me. Thank you!