Jump to content

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


Recommended Posts

Posted

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,

--

Bill Baker

Guest Pegasus \(MVP\)
Posted

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

 

 

"WB" <WB@discussions.microsoft.com> wrote in message

news:8DE1634C-68CC-4BCE-A9E4-316A54ADA46C@microsoft.com...

> 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,

> --

> Bill Baker

 

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.

Posted

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

 

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

 

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).

--

Bill Baker

 

 

"Pegasus (MVP)" wrote:

>

> "WB" <WB@discussions.microsoft.com> wrote in message

> news:8DE1634C-68CC-4BCE-A9E4-316A54ADA46C@microsoft.com...

> > 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,

> > --

> > Bill Baker

>

> 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.

>

>

>

Guest Pegasus \(MVP\)
Posted

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

 

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

 

Why is it not an option? The batch file would not care how

many times it has to invoke robocopy.exe!

 

"WB" <WB@discussions.microsoft.com> wrote in message

news:ABDEE964-B149-4A33-933E-B4F90917E68B@microsoft.com...

> 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).

> --

> Bill Baker

>

>

> "Pegasus (MVP)" wrote:

>

>>

>> "WB" <WB@discussions.microsoft.com> wrote in message

>> news:8DE1634C-68CC-4BCE-A9E4-316A54ADA46C@microsoft.com...

>> > 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,

>> > --

>> > Bill Baker

>>

>> 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.

>>

>>

>>

Posted

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

 

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

 

Then I don't understand your reply. How can I copy each file individually if

I don't specify the individual file names?

--

Bill Baker

 

 

"Pegasus (MVP)" wrote:

> Why is it not an option? The batch file would not care how

> many times it has to invoke robocopy.exe!

>

> "WB" <WB@discussions.microsoft.com> wrote in message

> news:ABDEE964-B149-4A33-933E-B4F90917E68B@microsoft.com...

> > 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).

> > --

> > Bill Baker

> >

> >

> > "Pegasus (MVP)" wrote:

> >

> >>

> >> "WB" <WB@discussions.microsoft.com> wrote in message

> >> news:8DE1634C-68CC-4BCE-A9E4-316A54ADA46C@microsoft.com...

> >> > 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,

> >> > --

> >> > Bill Baker

> >>

> >> 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.

> >>

> >>

> >>

>

>

>

Guest Pegasus \(MVP\)
Posted

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

 

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

 

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.

 

 

"WB" <WB@discussions.microsoft.com> wrote in message

news:38CFAA36-13C8-48BD-8D3C-D846CB3AE2DE@microsoft.com...

> Then I don't understand your reply. How can I copy each file individually

> if

> I don't specify the individual file names?

> --

> Bill Baker

>

>

> "Pegasus (MVP)" wrote:

>

>> Why is it not an option? The batch file would not care how

>> many times it has to invoke robocopy.exe!

>>

>> "WB" <WB@discussions.microsoft.com> wrote in message

>> news:ABDEE964-B149-4A33-933E-B4F90917E68B@microsoft.com...

>> > 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).

>> > --

>> > Bill Baker

>> >

>> >

>> > "Pegasus (MVP)" wrote:

>> >

>> >>

>> >> "WB" <WB@discussions.microsoft.com> wrote in message

>> >> news:8DE1634C-68CC-4BCE-A9E4-316A54ADA46C@microsoft.com...

>> >> > 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,

>> >> > --

>> >> > Bill Baker

>> >>

>> >> 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.

>> >>

>> >>

>> >>

>>

>>

>>

Posted

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

 

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

 

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,

--

Bill Baker

 

 

"Pegasus (MVP)" wrote:

> 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.

>

>

> "WB" <WB@discussions.microsoft.com> wrote in message

> news:38CFAA36-13C8-48BD-8D3C-D846CB3AE2DE@microsoft.com...

> > Then I don't understand your reply. How can I copy each file individually

> > if

> > I don't specify the individual file names?

> > --

> > Bill Baker

> >

> >

> > "Pegasus (MVP)" wrote:

> >

> >> Why is it not an option? The batch file would not care how

> >> many times it has to invoke robocopy.exe!

> >>

> >> "WB" <WB@discussions.microsoft.com> wrote in message

> >> news:ABDEE964-B149-4A33-933E-B4F90917E68B@microsoft.com...

> >> > 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).

> >> > --

> >> > Bill Baker

> >> >

> >> >

> >> > "Pegasus (MVP)" wrote:

> >> >

> >> >>

> >> >> "WB" <WB@discussions.microsoft.com> wrote in message

> >> >> news:8DE1634C-68CC-4BCE-A9E4-316A54ADA46C@microsoft.com...

> >> >> > 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,

> >> >> > --

> >> >> > Bill Baker

> >> >>

> >> >> 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.

> >> >>

> >> >>

> >> >>

> >>

> >>

> >>

>

>

>

Guest Pegasus \(MVP\)
Posted

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

 

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

 

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.

 

 

"WB" <WB@discussions.microsoft.com> wrote in message

news:9F835137-F23F-4F21-BEEE-6F92D6D8C7ED@microsoft.com...

> 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,

> --

> Bill Baker

>

>

> "Pegasus (MVP)" wrote:

>

>> 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.

>>

>>

>> "WB" <WB@discussions.microsoft.com> wrote in message

>> news:38CFAA36-13C8-48BD-8D3C-D846CB3AE2DE@microsoft.com...

>> > Then I don't understand your reply. How can I copy each file

>> > individually

>> > if

>> > I don't specify the individual file names?

>> > --

>> > Bill Baker

>> >

>> >

>> > "Pegasus (MVP)" wrote:

>> >

>> >> Why is it not an option? The batch file would not care how

>> >> many times it has to invoke robocopy.exe!

>> >>

>> >> "WB" <WB@discussions.microsoft.com> wrote in message

>> >> news:ABDEE964-B149-4A33-933E-B4F90917E68B@microsoft.com...

>> >> > 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).

>> >> > --

>> >> > Bill Baker

>> >> >

>> >> >

>> >> > "Pegasus (MVP)" wrote:

>> >> >

>> >> >>

>> >> >> "WB" <WB@discussions.microsoft.com> wrote in message

>> >> >> news:8DE1634C-68CC-4BCE-A9E4-316A54ADA46C@microsoft.com...

>> >> >> > 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,

>> >> >> > --

>> >> >> > Bill Baker

>> >> >>

>> >> >> 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.

>> >> >>

>> >> >>

>> >> >>

>> >>

>> >>

>> >>

>>

>>

>>

Posted

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

 

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

 

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,

--

Bill Baker

 

 

"Pegasus (MVP)" wrote:

> 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.

>

>

> "WB" <WB@discussions.microsoft.com> wrote in message

> news:9F835137-F23F-4F21-BEEE-6F92D6D8C7ED@microsoft.com...

> > 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,

> > --

> > Bill Baker

> >

> >

> > "Pegasus (MVP)" wrote:

> >

> >> 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.

> >>

> >>

> >> "WB" <WB@discussions.microsoft.com> wrote in message

> >> news:38CFAA36-13C8-48BD-8D3C-D846CB3AE2DE@microsoft.com...

> >> > Then I don't understand your reply. How can I copy each file

> >> > individually

> >> > if

> >> > I don't specify the individual file names?

> >> > --

> >> > Bill Baker

> >> >

> >> >

> >> > "Pegasus (MVP)" wrote:

> >> >

> >> >> Why is it not an option? The batch file would not care how

> >> >> many times it has to invoke robocopy.exe!

> >> >>

> >> >> "WB" <WB@discussions.microsoft.com> wrote in message

> >> >> news:ABDEE964-B149-4A33-933E-B4F90917E68B@microsoft.com...

> >> >> > 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).

> >> >> > --

> >> >> > Bill Baker

> >> >> >

> >> >> >

> >> >> > "Pegasus (MVP)" wrote:

> >> >> >

> >> >> >>

> >> >> >> "WB" <WB@discussions.microsoft.com> wrote in message

> >> >> >> news:8DE1634C-68CC-4BCE-A9E4-316A54ADA46C@microsoft.com...

> >> >> >> > 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,

> >> >> >> > --

> >> >> >> > Bill Baker

> >> >> >>

> >> >> >> 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.

> >> >> >>

> >> >> >>

> >> >> >>

> >> >>

> >> >>

> >> >>

> >>

> >>

> >>

>

>

>

×
×
  • Create New...