You are not logged in.

#1 23 Mar 2007 23:55

tspence
Member
Registered: 23 Mar 2007
Posts: 1

ROBOCOPY /quite

Is there a way to have robocopy error after the firsr file fails to copy rather than trying to copy all files before it send the error message?

EXAMPLE:

:title Currently Running backup for
:@echo off

:del x:\bimctest\*.* /Q

:time /t > copy_started.
:time /t > x:bimctest\copy_started
:ROBOCOPY/copyall /R:1 /W:10 /B c:\temp x:\bimctest

:if errorlevel == 9 net send noc02 check %computername%  there has been an error during the copy process of mdaprod.  Please restart it.
:end if
;next

:time /t > copy_completed.
:time /t > x:\bimctest\copy_completed

:end

In this script if the file fails robocopy tries again in 10 seconds and than goes to the next file.  I need it to /quite after the first files fails so my operators can either restart it or I need to know if there is a connectivity issue @ 3:00 in the morning.

Any ideas?

Offline

#2 27 Mar 2007 15:11

bluesxman
Member
From: UK
Registered: 29 Dec 2006
Posts: 1,129

Re: ROBOCOPY /quite

I have to presume that that's not the actual script you use, because there are all sorts of problems with it.

Anyway, I'd do something like this:

*** UNTESTED ***

set OK=1
for %%F in ("c:\temp\*.*") do (
    if defined OK (
        robocopy /fp /njs /njh /zb /copyall /R:1 /W:10 /B "%%~dpF\" "x:\bimctest" "%%~nxF" || set OK=
    )
)

if not defined OK net send noc02 check %computername% there has been an error during the copy process of mdaprod.  Please restart it.

You may or may not wish to use all the switches I've applied to "robocopy".  If you want it to fail on the first attempt at copying a given file, use /R:0 (for zero retries).

If you have a lot of files in c:\temp it might take a while to finish the "for" loop.  But there are ways and means around that, if needs be.

Last edited by bluesxman (27 Mar 2007 15:11)


cmd | *sh | ruby | chef

Offline

#3 27 Mar 2007 19:08

Simon Sheppard
Admin
Registered: 27 Aug 2005
Posts: 1,130
Website

Re: ROBOCOPY /quite

>>I need to know if there is a connectivity issue @ 3:00 in the morning.

This could be as simple as a PING command or something like

COPY marker_file Destination || echo the process failed so reboot
or
COPY marker_file Destination && robocopy....

Offline

Board footer

Powered by