tags:

views:

53

answers:

3

I have looked over the copy and xcopy batch commands. Both of them do not seem to support "copy new files only regardless file date time - name comparing only" option. Please advise.

+1  A: 
/D

 /D:m-d-y     Copies files changed on or after the specified date.
              If no date is given, copies only those files whose
              source time is newer than the destination time.

Edit: What do you mean by new?

leppie
sorry, what I wanted was name comparing option
Mark Attwood
@markattwood: So you only want to copy the files if they do not exist in the target?
leppie
Exactly. I have been trying FOR loop. But it's painful. It's simple but why MS doesn't support it.
Mark Attwood
Yeah, that DOES sound tricky. I dont have an answer. Good luck :)
leppie
@markattwood: Basically all you want is a 'never overwrite' option. :(
leppie
It's not that easy. If I specified /Y option, the CMD would override all files. I'm stuck with a simple copy solution. It takes me 6 lines long with FOR commands for this simple scenario.
Mark Attwood
A: 

Perhaps you should look at rsync. It has a Win32 port and it can copy files based on a number of considerations including whether it exists or is different at the destination.

I think you want the switch:

--ignore-existing       skip updating files that exist on receiver
SpliFF
+3  A: 

Have a look at ROBOCOPY. Invoking it with the following switches will recursively copy the files from source_dir that do not yet exist in destination_dir:

robocopy source_dir destination_dir /s /xc /xn /xo

Als see the RoboCopy Manual for an explanation of the switches.

sakra