Copy ONLY newer files

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
hoggar
Posts: 2
Joined: 05 Aug 2011 10:04

Copy ONLY newer files

#1 Post by hoggar » 05 Aug 2011 10:16

I use XCOPY /D option but it copies all the files with the NEWER and with the SAME (!!!) date.

Description for option says: copies only those files whose source time is newer than the destination time

How can I copy only with NEWER date but not the SAME?

Situation ... I make backup files every day and name it after weekdays so I have every 7 days the same filename. After I make backup I want to copy to second location only file from today which is newer than in second location. But XCOPY /D always copy ALL the files, with the newer date and with the same date, in other words the same files, I copy 6 same files and only 1 newer. Logically I would like to copy only 1 newer file.

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: Copy ONLY newer files

#2 Post by !k » 05 Aug 2011 11:27

If your system date format is m-d-y simple use xcopy /d:%date%
or xcopy /d:%date:/=-% if divider is /

hoggar
Posts: 2
Joined: 05 Aug 2011 10:04

Re: Copy ONLY newer files

#3 Post by hoggar » 05 Aug 2011 11:37

Thanky you for you reply.

I realized that this problem only occur when I copy to NAS. On local disks or USB stick everything is OK, only newer files are copied.

Does anybody knows what is the problem?

Post Reply