Advanced Windows PowerShell Scripting Video Training

Advanced Windows PowerShell Scripting Video Training
Advanced Windows PowerShell Scripting Video Training

Monday, February 11, 2013

How to copy a directory structure and all NTFS security attributes

This one was actually easier than I thought.  Robocopy seems to do a good job at this.  I created a folder structure that had empty folders and some NTFS permissions.  I called this folder that I wanted to copy Copytest.  I then executed this Robocopy command to make a copy of this folder structure on another hard drive.

Robocopy e:\CopyTest c:\CopyTest /sec /mir

image

The /SEC preserves the permissions and the /MIR creates a mirror of the original location on the destination.

3 comments:

George said...

Love Robocopy! Such a great tool and has worked for me flawlessly for years.

Steve said...

Robocopy is good, but how do you work with open files.

Steve said...

Only problem with Robocopy is that it will not work with open files. I was hoping that Copy-Item would work, but I don't see any info on it coping the ACL's, nor open files.