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.
\l
to test it out first; is there a better alternative to using\mir
?