When attempting to mirror two folders using Robocopy, the option /MIR causes files in the destination to be deleted when the source files are in use. Specifically this happens when backing up my Outlook folder and the *.pst files are in use.
The output is as follows:
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Tuesday, 18 August 2020 18:58:28
Source : P:\Outlook\
Dest : D:\_SyncFolderTest\To\Outlook\
Files : *.*
Options : *.* /BYTES /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /J /R:0 /W:30
------------------------------------------------------------------------------
23 P:\Outlook\
Newer 183116800 AVArchive_2018.pst
Newer 128009216 AVArchive_2019.pst
Newer 42427392 AVArchive_2020.pst
Newer 403801088 AVOutlook.pst
New File 131072 ~AVArchive_2018.pst.tmp
New File 131072 ~AVArchive_2019.pst.tmp
New File 131072 ~AVArchive_2020.pst.tmp
New File 131072 ~AVOutlook.pst.tmp
------------------------------------------------------------------------------
Total Copied Skipped Mismatch FAILED Extras
Dirs : 1 0 1 0 0 0
Files : 23 4 15 0 4 0
Bytes : 3545771008 524288 2787892224 0 757354496 0
Times : 0:00:00 0:00:00 0:00:00 0:00:00
Speed : 37449142 Bytes/sec.
Speed : 2142.857 MegaBytes/min.
Ended : Tuesday, 18 August 2020 18:58:28
It is correct that AVOutlook.pst is newer, but can't copy it, doesn't raise an error, and deletes the older version in the dest. So not only did it not back up, but the previous backup is now gone. The exit code is the only clue that something went wrong: 8 = Some files or directories could not be copied.
I kind of understand that the dest old file must be removed and replaced in order to achieve a mirror image, but why no error, and why not recognise that files in the source and dest are related? Is this a shortcoming in Robocopy or a design decision? Is there a safer way?
/purge
switch without using the/mir
switch as I stated. I suppose my comments were deleted by the mod before you could read. Simply don't use/mir
with the other options. Just ping me back if you're interested and I'll share more detail. I'll check back again to see if the comment gets removed before you read. – Drink More Pimp Juice IT Sep 16 '20 at 14:08