Re: robocopy validation

From: neo [mvp outlook] (neoheart_at_remove-heart.mvps.org)
Date: 07/15/04


Date: Wed, 14 Jul 2004 19:14:50 -0700

Found this old post, hopefully it is helpful.

>From RoboCopy.doc

Return Code
The return code from Robocopy (version 1.74 and later) is a bit map, defined
as
follows:
Hex Bit Value Decimal Value Meaning If Set
0x10 16 Serious error. Robocopy did not copy any files. This is either a
usage error or an error due to insufficient access privileges on the source
or
destination directories.
0x08 8 Some files or directories could not be copied (copy errors
occurred and the retry limit was exceeded). Check these errors further.
0x04 4 Some Mismatched files or directories were detected. Examine the
output log. Housekeeping is probably necessary.
0x02 2 Some Extra files or directories were detected. Examine the
output log. Some housekeeping may be needed.
0x01 1 One or more files were copied successfully (that is, new files
have arrived).
0x00 0 No errors occurred, and no copying was done. The source and
destination directory trees are completely synchronized.

You can use this information in a batch file to report the most serious
anomalies, as follows:

if errorlevel 16 echo ***FATAL ERROR*** & goto end
if errorlevel 8 echo **FAILED COPIES** & goto end
if errorlevel 4 echo *MISMATCHES* & goto end
if errorlevel 2 echo EXTRA FILES & goto end
if errorlevel 1 echo Copy successful & goto end
if errorlevel 0 echo --no change-- & goto end
:end

Alternatively, full details of the return code could be reported as follows:

if errorlevel 16 echo ***FATAL ERROR*** & goto end
if errorlevel 15 echo FAIL MISM XTRA COPY & goto end
if errorlevel 14 echo FAIL MISM XTRA & goto end
if errorlevel 13 echo FAIL MISM COPY & goto end
if errorlevel 12 echo FAIL MISM & goto end
if errorlevel 11 echo FAIL XTRA COPY & goto end
if errorlevel 10 echo FAIL XTRA & goto end
if errorlevel 9 echo FAIL COPY & goto end
if errorlevel 8 echo FAIL & goto end
if errorlevel 7 echo MISM XTRA COPY & goto end
if errorlevel 6 echo MISM XTRA & goto end
if errorlevel 5 echo MISM COPY & goto end
if errorlevel 4 echo MISM & goto end
if errorlevel 3 echo XTRA COPY & goto end
if errorlevel 2 echo XTRA & goto end
if errorlevel 1 echo COPY & goto end
if errorlevel 0 echo --no change-- & goto end
:end

"Richard Guse" <Richard_Guse@bose.com> wrote in message
news:da1f686a.0407141252.7ddf039c@posting.google.com...
> Does anyone know how to automatically validate robocopy? Normally, a
program
> would print to stderr if there was a problem but robocopy seems to always
> send everything to stdout. It looks like I'm stuck parsing the file for
> keywords (either looking in the FAILED column at the bottom or look in the
> output for other failure factors).
>
> Most of the failure messages I see (although rare) are access problems.
>
> But of course if I do this I'd have to be looking out for updates of
robocopy
> in the future which may change how the data is presented at the bottom of
the
> output. It would be nice if all FAILED data was sent to stderr.
>
> Thanks for any help.



Relevant Pages


Loading