5

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.

mcu
  • 3,302
  • 8
  • 38
  • 64

3 Answers3

8
/XF desktop.ini

Will exclude Desktop.ini (from copy or purge).

Richard
  • 106,783
  • 21
  • 203
  • 265
2

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.

  • 1
    Thanks, but I do want to purge destination of any extra files, except for 'desktop.ini'. So what I need is something like an exclude filter on the purge action. Of course, if the whole subfolder needs to be removed from destination, because it does not exist in source, then 'desktop.ini' should be removed along with it. Maybe I am asking too much here, but it would be nice to have this. – mcu Mar 07 '12 at 22:01
  • Yeah, I don't think you'll be able to do a conditional purge. Sorry mate. –  Mar 07 '12 at 22:47
0

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