Search code examples
batch-filexcopy

XCOPY to only look back one day


I have a current .BAT file that is functional but I need to be more specific with it. Currently, it will only copy over files that do not exist. What I am wanting to do is to only look back ONE day and copy those files. I have posted my file information below. Thank you in advance for the assistance.

XCOPY /y "w:\EFileRequests\*.xml" "\\DIS2\EFilingXML\Archive\"/D

Solution

  • Use robocopy, it has a parameter for exactly what you want.

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