Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So my company has recently upgraded to a new SAN but the person who copied all the data over must have done a drag n' drop or basic copy to move everything. Apparently Xcopy is not something he cared to use.

So now I am left with the task of duplicating all the permissions over. The structure has changed a bit ( as in more files/folders have been added) but for the most part has been stayed unchanged.

I'm looking for suggestions to help automate this process. Can I use XCopy to transfer ONLY permissions to one tree from another? Would I just ignore any folders/permissions that don't line up correctly?

share|improve this question

1 Answer 1

You might try to use icacls to backup and restore the permissions.

I wrote a blog entry about this.

A simple example shows how to do this using a single command line statement. I want to backup the permissions on the folder E:\ZedaTest and it's subfolders and -files.

To do so, I created a batchfile containing the following command.

icacls.exe E:\Data\Zedatest\* /save E:\Data\acl_zedatest.txt /t /c

This script reads all file permissions of the files and folders including subfolders (/t), ignoring errors (/c). Results are written to the file E:\Data\acl_zedatest.txt. This file looks like this:

Folder1
D:AI(A;OICIID;FA;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)
Folder2
D:AI(A;OICI;FA;;;S-1-5-21-2427325736-2493757636-818923003-2778)(A;OICIID;FA;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)
Folder3
D:AI(A;OICIID;FA;;;WD)(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)
Folder1\testfile1.txt
D:AI(A;ID;FA;;;WD)(A;ID;FA;;;SY)(A;ID;FA;;;BA)
Folder2\testfile3.txt
D:AI(A;ID;FA;;;S-1-5-21-2427325736-2493757636-818923003-2778)(A;ID;FA;;;WD)(A;ID;FA;;;SY)(A;ID;FA;;;BA)
Folder3\testfile1.txt
D:AI(A;ID;FA;;;WD)(A;ID;FA;;;SY)(A;ID;FA;;;BA)
Folder3\testfile2.txt
D:AI(A;ID;FA;;;WD)(A;ID;FA;;;SY)(A;ID;FA;;;BA)
Folder3\testfile3.txt
D:AI(A;ID;FA;;;WD)(A;ID;FA;;;SY)(A;ID;FA;;;BA)
share|improve this answer
    
Thanks ZEDA, i'll give it a shot and report back! –  Tyler Benson Mar 22 '12 at 0:54
    
SO just a clarification, I use that line provided ( swapping out the correct paths), then once everything is processed, i can use the restore command to restore those acl files to the new SAN ( say I:* /save I:\file.txt/ then do a j:* /restore I:\file.txt) ? And I'll be trying this on a smaller group of folders first, so if it messes up the perms, i can just manually fix them, correct? –  Tyler Benson Apr 9 '12 at 21:18
    
That should do the trick. I suggest to backup both the source as the destination ACL's before restoring the source ACL's to the new SAN. You can always fix it manualy of course, but if it happens to fail, you can restore the original ACL's this way. –  ZEDA-NL Apr 10 '12 at 14:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.