How do I copy new files and modified files having new time/date?

D

Don J

I would like to copy all files having a specified extension from a set of
source directories to a set of target directories having the same names as
the source directories, where the transferred files don't already exist with
the same name and time/date in the corresponding target directory. If a
file does exist in the same named target directory having the same name as
the file in the source directory along with the same time/date then the
transfer is aborted. If a file exists with the same name but a different
time/date, then the preexisting file in the target directory should be
overwritten, with the time/date of the file in the target directory being
replaced by that of the transferred file.

Don J

----------------------------------------------------------------------------------
 
P

Pegasus \(MVP\)

Don J said:
I would like to copy all files having a specified extension from a set of
source directories to a set of target directories having the same names as
the source directories, where the transferred files don't already exist with
the same name and time/date in the corresponding target directory. If a
file does exist in the same named target directory having the same name as
the file in the source directory along with the same time/date then the
transfer is aborted. If a file exists with the same name but a different
time/date, then the preexisting file in the target directory should be
overwritten, with the time/date of the file in the target directory being
replaced by that of the transferred file.

Don J

--------------------------------------------------------------------------
--------

You write "If a file exists with the same name but a ***different***
time/date, then the preexisting file in the target directory should be
overwritten, with the time/date of the file in the target directory being
replaced by that of the transferred file."

I don't think you mean what you write. You probably mean this:
"If a file exists with the same name but an ***older*** time/date,
then the preexisting file in the target directory should be overwritten,
with the time/date of the file in the target directory being replaced
by that of the transferred file."

The short answer is: Put an appropriate xcopy.exe command into
a batch file and use the /d switch.
 
O

over

--------

You write "If a file exists with the same name but a ***different***
time/date, then the preexisting file in the target directory should be
overwritten, with the time/date of the file in the target directory
being replaced by that of the transferred file."

I don't think you mean what you write. You probably mean this:
"If a file exists with the same name but an ***older*** time/date,
then the preexisting file in the target directory should be
overwritten, with the time/date of the file in the target directory
being replaced by that of the transferred file."

The short answer is: Put an appropriate xcopy.exe command into
a batch file and use the /d switch.

You may also want to look at the replace.exe command

Or for even more options, download robocopy or synctoy from Microsoft
or xxcopy from www.xxcopy.com (plug those program names into
MSN/Google/whatever search engine you like)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top