uwhtp
uwhtp

Reputation: 13

Use Roboopy to copy files newer than yesterday (Windows)

I'm trying to copy only new files that have been added in the last 2 days for backup

@ECHO OFF
robocopy D:\Auto\finished D:\Auto\backup *.* /maxage:2

Upvotes: 0

Views: 2951

Answers (1)

rbashish
rbashish

Reputation: 2153

Try this:

@ECHO OFF
robocopy <sourcepath> <destination path> /E /XO /XN

/E - copies sub-directories as well as files including empty directory

/XO - exclude old files i.e. files on source that also exist at the destination but has older or same time-stamp.

/XN - exclude newer files i.e. files on source that also exist at the destination but has newer time-stamp

To see more option: use this robocopy /? in cmd prompt.

Upvotes: 1

Related Questions