Migrating file server shares with permissions intact
February 18, 2013
Posted by on
When you are copying files from one server to another or one volume to another and need to retain the file permissions, robocopy is your guy. In order to speed things up, I will frequently start multiple windows. To do this, I will put together multiple lines into a single powershell script that opens multiple windows for me. Call me lazy, but it works.
cmd.exe /c start cmd /k “ROBOCOPY \\ohsfsdc1\g$\Share1 D:\Share1 /MIR /SEC”
cmd.exe /c start cmd /k “ROBOCOPY \\ohsfsdc1\g$\Share2 D:\Share2 /MIR /SEC”
… and so on
Couple things about this:
- I usually run it from the destination server (where I am copying things to).
- You can use this to stage the files, and then rerun it later to grab the stragglers.
- I don’t believe that it deletes files from the destination that were deleted at the source.
- This only copies the folder level permissions. If they have file level permissions (which they shouldn’t because they are evil), there is another robocopy command that you can run that will copy those individual permissions after the main copy has finished.