![]()
[<<]Message[>>] [<<]Author[>>] [<<]Subject[>>] [<<]Thread[>>]
Number : 4036 Date : 2003-03-13 Author : Garry Deane Subject : Re: XXCOPY rename/backup file before copy from source ? Size(KB) : 1
--- In xxcopy@yahoogroups.com, "raymond_n2003" wrote: > Hi, > I am just wondering, is it possible to get XXCOPY to > perform below task in one command line : > > 1. copy few files from one directory (it could contain > sub directory) to another directory (maintain same > structure). > 2. if the source file exist in target directory, rename > it, by put it a suffix (e.g. date, 01012003) into the > file name, and then copy the file from source. > 3. Generate a log file on this. > There's no way xxcopy (or anything else that I'm aware of) can do this, let alone in a 1 line command! For a start, xxcopy doesn't perform renaming while copying. You're going to need some batch processing to handle this. He's one way you might approach it. 1. Copy the files excluding any files which already exist in the destination and write a log with the names of the skipped files. xxcopy /bu/bb/os/on:xxcopy.log 2. Seach the log for "(/BB)" entries which indicate same name files. find "(/BB)" rename.lst 3. Manually edit this file or use a list processing or search and replace utility in DOS/W9x/ME to create a batch file which renames the files in the destination and logs the renames. In NT/W2k/XP you can use FOR /F to process this list directly. This part will be a bit tricky because you have to convert a line like: C:\Program Files\Common Files\System\wab32.dll (/BB) into REN "D:\Program Files\Common Files\System\wab32.dll" *.%date% where %date% has been determined using similar techinques. 4. Run xxcopy again to copy the files which weren't previously copied. It's do-able but not an easy one. Garry
This message if part of XXCOPY's message Archive. The archive contains all the messages posted at Yahoo!Groups: XXCOPY.