0

Note: This example is making a copy of an existing directory to an non-existing prior to copying directory.

Note: When my scheduled tasks were giving me an error, this is how I went about attempting to resolve it.

Step 1: Copying the Files to the Destination Directory

robocopy C:\sourceDir C:\destDir *.* /copy:DATSOU /e

Copying the files...

Step 2: Copying the Permissions to the Destination Directory

robocopy C:\sourceDir\ C:\destDir *.* /mir /secfix /sec

Copy the permissions to the files in the destination directory

Note: Remember that the [[/mir]] command can delete folders in the destination directory if they are in the source directory, but not in the destination directory.

Step 3: Verifying the permissions using powershell

This can be verified using powershell:

Get-ACL "C:\sourceDir\GoogleUpdateTaskMachineUA" | Format-List

Get-ACL "C:\destDir\GoogleUpdateTaskMachineUA" | Format-List

...and comparing the outputs...with diff or some similar tool to do a spot check (of course the path line isn't going to match, but the rest of it should).

Step 4: Spot Check attributes

Running ls on the directory in powershell should show the attributes of each file.

3
  • why do you make it two step copying? /sec is sufficient to copy and preserve permissions. BE CAREFUL WITH /mir parameter! It will remove files from original place if you make changes in destination.
    – strongline
    May 5, 2015 at 17:18
  • @strongline Because I read here yakupkorkmaz.info/?p=12 that this is what you must do to include the ACLs (but I believe I also saw it in the documentation from Microsoft). I usually use \l to test it out first; is there a better alternative to using \mir ?
    – leeand00
    May 5, 2015 at 18:18
  • 1
    The link given didn't say to copy with /e then /sec. It just said that you can use /sec to copy permissions as well. Actually if you want to copy owner info too, /sec won't be enough, use copy:DATO. As for /mir, it is short for mirror. So the sync will be two-way. If you delete a file @destination, that deletion will be replicated to source, and the file will be forever gone.
    – strongline
    May 5, 2015 at 19:36

0

You must log in to answer this question.

Browse other questions tagged .