You are not logged in.

#1 17 Jan 2012 20:06

techvet
Member
Registered: 17 Jan 2012
Posts: 6

Robocopy 112 error issue: "feature", bug, or bad coding by me?

I use Robocopy to copy large ZIP files overnight over a WAN connection.  Each file has its own directory, so even though there is wild-carding below, there's only one file actually available in each case.

-------------------------------------
IF %computername% == SERVER1 robocopy "D:\BACKUP-DR\zipped\%1" "\\SERVER2\d$\backup-dr\zipped" *.* /COPYALL /MOV /MT:10 /R:1 /LOG:"D:\BACKUP-DR\%computername%.%1.%2.log"
IF ERRORLEVEL 1 GOTO NORMAL
------------------------------------

Now here's where the problem came up the other night.

The destination side had a disk full problem (new server, monitoring system not yet set up!) so that the attempt to copy a few files failed.  That part is fine.  What dismayed me is the following:

1.  The attempt failed and so did the retry.  Yet, despite the fact that anything other than ERRORLEVEL 1 should kick up an error, the error-checking didn't catch it (and this checking has been verified for other types of errors, so I know it works).

2.  Even though I use the /MOV option, I found out through past experience that ROBOCOPY doesn't always delete the files after they have been copied.  Therefore, on a normal copy, I make sure everything is cleaned up with an RD statement.  Well, because the batch file didn't detect the 112, it merrily deleted the file(s) that didn't get copied, thinking it had worked.

What's with ROBOCOPY returning a normal ERRORLEVEL when the copy failed along with the retry?  Should I remove the /R:1 to force the 112 to get passed on?

Thanks,

Tom

(Log file below from the failed copy)

--------------------------------------------------------------

                  1    D:\BACKUP-DR\zipped\FILE1.DBF\
        New File           321.6 m    SERVER1.FILE1.DBF.2012-01-15.1-45-00.88.backup.zip
2012/01/15 02:47:11 ERROR 112 (0x00000070) Copying File D:\BACKUP-DR\zipped\FILE1.DBF\SERVER1.FILE1.DBF.2012-01-15.1-45-00.88.backup.zip
There is not enough space on the disk.

Waiting 30 seconds... Retrying... Retrying...
2012/01/15 02:48:04 ERROR 112 (0x00000070) Copying File D:\BACKUP-DR\zipped\FILE1.DBF\SERVER1.FILE1.DBF.2012-01-15.1-45-00.88.backup.zip
There is not enough space on the disk.


ERROR: RETRY LIMIT EXCEEDED.


------------------------------------------------------------------------------

               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         1         0         1         0         0         0
   Files :         1         0         0         0         1       743
   Bytes :  321.63 m         0         0         0  321.63 m 339.847 g
   Times :   0:31:10   0:00:40                       0:00:00   0:29:47

   Ended : Sun Jan 15 02:48:04 2012

Offline

#2 17 Jan 2012 21:52

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

Re: Robocopy 112 error issue: "feature", bug, or bad coding by me?

This is a common misunderstanding with the IF command

IF ERRORLEVEL 1 will return TRUE when the errorlevel is 112

a more logical syntax is to use:
IF %ERRORLEVEL% EQU 0 Echo No error found

see http://ss64.com/nt/if.html for more examples

Offline

#3 17 Jan 2012 21:54

techvet
Member
Registered: 17 Jan 2012
Posts: 6

Re: Robocopy 112 error issue: "feature", bug, or bad coding by me?

OK, so I'll change mine to read (because this is Robocopy)

------------------------------------------------
IF %ERRORLEVEL% EQU 1 Echo No error found
------------------------------------------------

Thanks!

-Tom-

Offline

#4 17 Jan 2012 22:07

techvet
Member
Registered: 17 Jan 2012
Posts: 6

Re: Robocopy 112 error issue: "feature", bug, or bad coding by me?

Correction: IF %ERRORLEVEL% EQU 1 GOTO NORMAL

Offline

#5 17 Jan 2012 22:13

techvet
Member
Registered: 17 Jan 2012
Posts: 6

Re: Robocopy 112 error issue: "feature", bug, or bad coding by me?

Simon,

Why does http://ss64.com/nt/robocopy-exit.html use the same logic I was using?

-Tom-

Offline

#6 17 Jan 2012 22:24

techvet
Member
Registered: 17 Jan 2012
Posts: 6

Re: Robocopy 112 error issue: "feature", bug, or bad coding by me?

techvet wrote:

Correction: IF %ERRORLEVEL% EQU 1 GOTO NORMAL

Correction - it should read:

IF %ERRORLEVEL% EQU 1 GOTO NORMAL
IF %ERRORLEVEL% EQU 3 GOTO NORMAL

That's because a 1 and a 3 are both codes for good copies with no failures, no mismatches, etc.  A 3 simply means that Robocopy is noticing files on the other side.  I am using Robocopy only to move files, not to synchronize directories.

Offline

#7 18 Jan 2012 00:20

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

Re: Robocopy 112 error issue: "feature", bug, or bad coding by me?

techvet wrote:

Simon,

Why does http://ss64.com/nt/robocopy-exit.html use the same logic I was using?

-Tom-

good point, I'll change that

Offline

#8 18 Jan 2012 00:41

techvet
Member
Registered: 17 Jan 2012
Posts: 6

Re: Robocopy 112 error issue: "feature", bug, or bad coding by me?

Thanks again for your help.  I don't recall but I may have scammed the code from that page.  Thanks very much for your help.  Any site that quotes Malcolm Muggeridge is already above-average. ;^)

Offline

Board footer

Powered by