copy files with exclude
Moderator: DosItHelp
copy files with exclude
Hi,
I need batch file that can use xcopt,robocopy...
It's copy from source to dest only the files that on dest are empty files(with 0 size).
like copy not overwrite but only for empty files on dest...
Thanks in advance...
I need batch file that can use xcopt,robocopy...
It's copy from source to dest only the files that on dest are empty files(with 0 size).
like copy not overwrite but only for empty files on dest...
Thanks in advance...
Re: copy files with exclude
Well I think you would start by using a for loop to check the file size of the destination files.
If the File size is Zero Then use an IF EXIST command to see if the same file name exists in the source and If it does then copy the source to the destination.
If the File size is Zero Then use an IF EXIST command to see if the same file name exists in the source and If it does then copy the source to the destination.
Re: copy files with exclude
Robocopy has the /MAX:0 switch that will exclude files bigger than n bytes. Here it is shown with 0 bytes.
Re: copy files with exclude
foxidrive wrote:Robocopy has the /MAX:0 switch that will exclude files bigger than n bytes. Here it is shown with 0 bytes.
But I would assume that would be for the source file and not the destination.
Re: copy files with exclude
Yes, that's right. I hadn't considered that the OP had created zero byte files in the destination.
Hmmm, he says this:
I'm a little confused. So copy but not overwrite zero byte files.
Xcopy with /D can do that if you update the timestamps on all the zero byte files.
That might work.
Hmmm, he says this:
like copy not overwrite but only for empty files on dest...
I'm a little confused. So copy but not overwrite zero byte files.
Xcopy with /D can do that if you update the timestamps on all the zero byte files.
That might work.
Re: copy files with exclude
foxidrive wrote:Yes, that's right. I hadn't considered that the OP had created zero byte files in the destination.
Hmmm, he says this:like copy not overwrite but only for empty files on dest...
I'm a little confused. So copy but not overwrite zero byte files.
Yes. Technically you would have to overwrite them in the destination.
Re: copy files with exclude
Xcopy with /D can do that if you update the timestamps on all the zero byte files with a script.
That might work.
EDIT:
Hmm Now I am confused again.
mor.bas, which files are meant to be excluded? The zero byte files? Or every file which is not zero bytes?
That might work.
EDIT:
It's copy from source to dest only the files that on dest are empty files(with 0 size).
Hmm Now I am confused again.
mor.bas, which files are meant to be excluded? The zero byte files? Or every file which is not zero bytes?
Re: copy files with exclude
foxidrive wrote:Xcopy with /D can do that if you update the timestamps on all the zero byte files with a script.
That might work.
EDIT:It's copy from source to dest only the files that on dest are empty files(with 0 size).
Hmm Now I am confused again.
mor.bas, which files are meant to be excluded? The zero byte files? Or every file which is not zero bytes?
I think they really meant to say include and not exclude. If you want to copy the zero byte files that would be an include.
If you don't want to copy zero byte files in the destination then it would be an exclude.
Re: copy files with exclude
It says exclude in the thread subject, so I followed with that.