You are not logged in.

#1 15 Oct 2007 06:56

knockout
Member
Registered: 15 Oct 2007
Posts: 2

Robocopy - error handling

Hi,

I have a batch script with the following logic:

robocopy.exe sourcedir destdir /R:0 /S /LOG:log.txt


IF %ERRORLEVEL% GEQ 8 (

    // Email me
    GOTO :EOF

)

However, when I look at the log file, it has the following:

2007/10/14 19:17:27 ERROR 112 (0x00000070) Copying File sourcedir\filename.ext

There is not enough space on the disk.

It skips this file and goes to the next file without e-mailing me.

What am I doing wrong? How do I get the script to e-mail me on ANY error?

Thanks!

Offline

#2 15 Oct 2007 21:44

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

Re: Robocopy - error handling

I'm guessing it sets the errorlevel to something between 1 and 7 when the problem is disc space

Try testing it by adding an ECHO ERRORLEVEL is [%ERRORLEVEL%]

Offline

#3 16 Oct 2007 02:37

knockout
Member
Registered: 15 Oct 2007
Posts: 2

Re: Robocopy - error handling

The value of errorlevel returned is 8. The issue is: It is returned after it reaches the last file. What I am trying to do is: E-mail when there is an error (on any file) and not on the last file.

Offline

Board footer

Powered by