Windows 10 Home 21H2 19044.1526, 64-bit
Robocopy 10.0.19041.1266
Run Robocopy via .bat file, Run as Administrator.
Hello:
When I use Robocopy to copy the root directory of a drive (D:) to a folder (non-root directory) on an external drive, the resulting destination folder is Hidden. I believe that's because the root drive has System and Hidden attributes.
How can I prevent System and Hidden attributes from being applied to the destination folder?
My testing (I removed options for multi-threads, retries, logging, etc., to make it easier for you folks to read.):
SET options=/MIR /A-:RSHA /XA:SH /XJ /XD "$RECYCLE.BIN" "System Volume Information" /XF DESKTOP.INI
ROBOCOPY "D:" "Y:\Backups\Test" %options%
/A-:RSHA does not work to prevent the destination folder from being hidden, though I read that it should work.
So, I added /COPY:DT /DCOPY:DT to options so as not to backup properties and attributes:
SET options=/COPY:DT /DCOPY:DT /MIR /A-:RSHA /XA:SH /XJ /XD "$RECYCLE.BIN" "System Volume Information" /XF DESKTOP.INI
ROBOCOPY "D:" "Y:\Backups\Test" %options%
/COPY:DT /DCOPY:DT did not help, as destination backup folder is still created as hidden.
I can run ATTRIB command after the backup, as in:
attrib -s -h "Y:\Backups\Test"
This does unhide the hidden directory, but I would prefer to find a way to prevent Robocopy from hiding the backup in the first place.
How can I prevent System and Hidden attributes from being applied to the destination folder?