Robocopy backup with date added BUT don’t copy if you already have the files

I have found several posts about adding the date stamp to a backup but what I would like to do goes a bit beyond that. My situation is as follows:

Weekly we do manual backups of software apps, databases, alarms, events and such. The day of the week the backup occurs on could vary. So I created a robocopy batch file that copies from my source to my destination like so:

Robocopy “source” “destination” /S /E /ZB /R:10 /W:5 /V /ETA /LOG+:c:\log.text

I would like to add the timestamp to the destination, but since this is scheduled to run daily, I really only want a copy when the files change. Since I cannot predict the day the backup gets run, I have chosen daily but can’t figure out how to still separate the backups by date, while not taking a copy everyday?

Answer

/XO

eXclude Older – if destination file exists and is the same date or newer than the source – don’t bother to overwrite it.

Attribution
Source : Link , Question Author : Chris Hill , Answer Author : HopelessN00b

Leave a Comment