Given two directories "C:\T" (the source/working directory) and "G:\T" (the destination/backup directory). Executing:
copy /z /w /u /y c:\t g:\t
What happens to read-only files in the destination depends upon if the corresponding file exists in the source director.
If the corresponding file exists in the source directory, the destination file is updated and the read-only attribute is removed.
If the corresponding file does not exist in the source directory, the copy command indicates that the destination file is deleted without actually deleting it nor changing its attributes.
I am using TCC 24.01.41 x64 Windows 10 [Version 10.0.17134.590]
Another flag would be fine. I'd just like to point out that the current implementation does output a message that it is deleting the existing read-only files.
I found to handle hidden and system files with robocopy requires two passes, the first for normal files (no /IA: option) and the second for the hidden/system files (with a /IA:SH option).
I found to handle hidden and system files with robocopy requires two passes, the first for normal files (no /IA: option) and the second for the hidden/system files (with a /IA:SH option).
Interesting, I've been using ROBOCOPY since Window XP when I first wrote a batch file to handle all of the common options. The batch file had two work arounds because of issues with ROBOCOPY. 1) The Windows 7 version had a bug that caused a destination directory to be marked as hidden/system if the source was a drive. 2) Check for hidden and/or system files because they were normally ignored. I can finally remove both of these work arounds. I wonder when they corrected this?
Item 1 isn't technically a bug. The root directory really does have the HS attributes set. Robocopy dutifully replicates that in the target. I do agree that this is probably always not desired, but you can easily undo it by running attrib after the robocopy command.
I don't know about item 2. As far as I know robocopy has never skipped such files by default, but it's been a long time since I've used the robocopy from XP/2003 days.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.