I've been working on a batch file to copy files from my Google Drive to a local drive using Robocopy. I would like to monitor it for any errors so that I can then take actions (like sending an email to myself).
I have all parts working except for the "monitoring the error" part. Admittedly I probably don't understand error codes well enough. Below is a sample of my batch file (testing the error handling with simple echo statements). Currently I don't seem to get any feedback at all from the echo statements no matter what the errorlevel is. Nothing is ever printed out to the console.
robocopy %source% %dest% /e /copy:DATSO /purge /z /r:5 /w:5 /v /mon:1 /log+:%logfile% /rh:0700-1900
if %ERRORLEVEL% GTR 1 (echo You broke it) else (echo All is good)
What I would like to accomplish is to have Robocopy run for a portion of the day, monitor the source for changes, and, if there are any errors, notify me. I'm not married to doing it via the ERRORLEVEL, so if I'm missing a better option, I'd love to learn about it.