robocopy /MIR - don't delete desktop.ini in destination
-
09-12-2019 - |
Frage
I want to sync folders between two computers, one with XP and one with Vista. I want the two folders mirrored, except for security settings and folder settings. It is my understanding that /MIR
switch will delete any 'extra' files in the destination folder, which would include the desktop.ini files. I can avoid copying desktop.ini files with /XA:SH
How can I prevent robocopy from deleting the destination desktop.ini files?
If I have to do any extra scripting, I prefer PowerShell. But I hope robocopy can do it on its own.
Thanks.
Lösung
/XF desktop.ini
Will exclude Desktop.ini
(from copy or purge).
Andere Tipps
Replace the /MIR switch with /E, and don't use the /PURGE parameter.
Explanation: /MIR is the equivalent of using /E /PURGE, so by using /E without /PURGE, you achieve the results you desire.
Create a bat file so you can mirror the source at the destination and later once the mirror process is finish erase the files you desired. For example:
robocopy SOURCE DEST /E /PURGE or /MIR or /E command to erase recursively (test the command before running at production): del /s DRIVe:\DESTINATION\desktop.ini
Hope this helps, Luis