Is there a way to have Robocopy end if max retries are reached?

W

WB

I'm using Robocopy with the following switches (with /E only when copying
folders):
/E /w:15 /r:14 /TEE /LOG+:%LOGFILE% /NJS /NP

If a network connection is lost (i.e. if I unplug the cable), and max
retries are reached, Robocopy moves to the next file in the folder and
retires that one 14 times every 15 seconds. It repeats this for every file in
the folder. For a folder with lots of files, this is a big waste of time.
Also, if any files fail, and subsequent files get copied successfully, this
is still an overall failure (for most situations). I know that exit codes can
be used in this case, but it still doesn't make sense to me that it should
attempt to copy subsequent files if there were any copying failures at all.

Is there any way to have Robocopy just stop the copying operation if max
retires are reached on any file?

Thanks,
 
P

Pegasus \(MVP\)

WB said:
I'm using Robocopy with the following switches (with /E only when copying
folders):
/E /w:15 /r:14 /TEE /LOG+:%LOGFILE% /NJS /NP

If a network connection is lost (i.e. if I unplug the cable), and max
retries are reached, Robocopy moves to the next file in the folder and
retires that one 14 times every 15 seconds. It repeats this for every file
in
the folder. For a folder with lots of files, this is a big waste of time.
Also, if any files fail, and subsequent files get copied successfully,
this
is still an overall failure (for most situations). I know that exit codes
can
be used in this case, but it still doesn't make sense to me that it should
attempt to copy subsequent files if there were any copying failures at
all.

Is there any way to have Robocopy just stop the copying operation if max
retires are reached on any file?

Thanks,

Instead of using a wildcard for robocopy, you would have to write
a batch file that causes each file to be copied individually by
robocopy. You can then terminate the batch file when the
connection fails.
 
W

WB

Unfortunately I have hundreds of files being copied, so this is not really an
option. Seems like something that should have been part of Robocopy to begin
with (just like the ability to move files).
 
P

Pegasus \(MVP\)

Why is it not an option? The batch file would not care how
many times it has to invoke robocopy.exe!
 
W

WB

Then I don't understand your reply. How can I copy each file individually if
I don't specify the individual file names?
 
P

Pegasus \(MVP\)

Batch files are quite good at enumerating files. If you
post your typical robocopy command then I'll show you
how to arrange it so that each file is copied individually
and that the process terminates when the connection is
lost.
 
W

WB

ROBOCOPY "Z:\TOOLS "D:\TOOLS" /E /w:15 /r:14 /TEE /LOG+:C:\TOOLS.LOG /NJS /NP

BTW: I recently had to replace two similar Robocopy commands with xcopy,
since Robocopy was only copying the sub-folders from the source to the
destination (it was not copying the files from the root of the source
folder). I'll post this as a seperate issue.

Thanks,
 
P

Pegasus \(MVP\)

On closer examination this problem turns out to be more
complex than I anticipated. It could probably be resolved
using forfiles.exe or else with some VB Script. I recommend
you repost the question in alt.msdos.batch.nt and/or in
microsoft.public.scripting.vbscript.
 
W

WB

I'm not blaming you, and I appreciate your help, but again this should be
something that is built-in to robocopy (along with the ability to move files,
and rename destination files).

If possible, please pass this along as a feature request to add these basic
functions to robocopy.

Thanks again,
 

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