Marc Kean

January 3, 2013

Copy NTFS permissions only and no data from source to target

Filed under: Computers and Internet,Uncategorized — marckean @ 10:57 am

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.

4 Comments »

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

    Comment by Bob Stockwell — June 29, 2013 @ 2:06 am | Reply

  2. Thanks! Just what I was looking for

    Comment by Jack — April 9, 2014 @ 5:17 am | Reply

  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.

    Comment by Phil — April 30, 2014 @ 7:40 am | Reply

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

    Comment by Claudio Ionfrida — November 24, 2014 @ 8:52 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a 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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

The Rubric Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 68 other followers

%d bloggers like this: