Robocopy - Backup only new files

1

I have an access to a network drive where news folder are created everyday. This drive is named G:

I want to backup all the folders from G:\ to D:\WebUpload

Being given that there are a lot of files, I would like to copy only the newest. By the newest I mean the files that are not backuped yet from G: to D:

I created this script

robocopy  G:\ D:\WebUpload\ /E  /XO /R:3 /W:5 /XA:S /XF *.tmp *.bak /TEE /XD $RECYCLE.BIN "System Volume Information"

But this script copy the whole content everytime.

EDIT

I edited the script to add /FFT

robocopy  G:\ D:\WebUpload\ /E  /FFT /XO /R:3 /W:5 /XA:S  /TEE /XD $RECYCLE.BIN "System Volume Information"

REM Source to Dest
REM /E Subfolder
REM /XO Exclude old files
REM /R Retry x times
REM /W sec between each retry
REM /TEE Display in the command prompt
REM /XD Exclude [][]

You can see that the folder named 20150304103_8 is present on both location G:\ and D:\WebUpload.

enter image description here

But the script analyse each file in this folder. It takes 1 second / file and I have >1000 files for few folders... So it is too long

enter image description here

Atnaize

Posted 2015-08-21T11:49:12.073

Reputation: 834

/XO should do exactly that. It will check all files but won't copy if it already exists at the target location. – HoD – 2015-08-21T12:06:07.890

Are you saying this doesn't work? – Dave – 2015-08-21T12:29:52.000

/MIR might be helpful but this will also delete files off the backup destination when they are deleted from the source; this might not be what you want. – Richard Lucas – 2015-08-21T13:06:34.273

@Dave Yes, the script copy all files despite the fact that they are already backuped in D:\WebUpload – Atnaize – 2015-08-21T13:19:26.383

Answers

1

Most likely you need /FFT to relax the comparison of timestamps.

Edit - each file system stores timestamps with certain precision. NTFS has precision of 1/10 of microsecond, both for created and modified timestamps. FAT has 10 ms and 2 seconds respectively [1]. So if you are copying from NTFS to FAT, then timestamps are getting rounded up and on the next run they won't match when compared between src and dst, causing files to get re-copied. All /FFT does is that it forces robocopy to use FAT precision when comparing timestamps, making it more lax.

[1] https://msdn.microsoft.com/en-us/library/windows/desktop/ms724290%28v=vs.85%29.aspx

Angstrom

Posted 2015-08-21T11:49:12.073

Reputation: 610