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
2010-08-17 05:15:02
sorry, what I wanted was name comparing option
Mark Attwood
2010-08-17 05:18:36
@markattwood: So you only want to copy the files if they do not exist in the target?
leppie
2010-08-17 05:22:04
Exactly. I have been trying FOR loop. But it's painful. It's simple but why MS doesn't support it.
Mark Attwood
2010-08-17 05:26:00
Yeah, that DOES sound tricky. I dont have an answer. Good luck :)
leppie
2010-08-17 05:28:39
@markattwood: Basically all you want is a 'never overwrite' option. :(
leppie
2010-08-17 05:29:38
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
2010-08-17 05:36:22
+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
2010-08-17 07:38:33