Search code examples
batch-filerobocopy

Robocopy Scripts


So I am looking for a nice batch file using the robocopy function to make a copy of my Win7 client machines Backup and Restore folders to a NAS. Each day a new folder is created in a backup set parent folder, so in theory, all I want robocopy to do is copy that new folder every night rather then the entire directory every night.

As of now - I am using robocopy /MIR but it still copies everything across each time as OLDER even though the folders haven't changed.

Any ideas how this can be done?

Cheers


Solution

  • Use the /XO option.

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

    Another option would be to use the /MaxAge:1 option.

    /MAXAGE:n : MAXimum file AGE - exclude files older than n days/date.
    

    RoboCopy /?