Robocopy Log Scanner
Robocopy Log Scanner provides Emailing and Zip functionality! Download it at RobocopyLogScanner.com
A handy little supplement to a standard robocopy mirror job. Robocopy is great for getting a mirror copy and a comprehensive log file, but if using it for regular backups, its handy to have an email notification when it completes.
Looking through the logs for errors can be tedious and tricky. This script will scan the log file before emailing it with a summary on how many errors it found.
You can get the latest version of robocopy from Microsoft
The below example is a windows batch file that first runs the copy job, then invokes Robocopy Log Scanner
:: Batch File to run robocopy and invoke Robocopy Log Scanner
set source="D:\data"
set dest="\\backupserver\backup$"
set log="c:\path-to-robocopy-log-file.log"
ROBOCOPY %source% %dest% /E /Z /SEC /MIR /LOG:%log%
RobocopyLogScanner.exe /s
Great, thank you!
[...] http://korel.com.au/vbs/robocopy-log-scanner/ [...]
Thanks, saves me big time and a lot of complains
I thank you kindly for this useful script!
Exactly what I was looking for.
I have a question though,
In the code you’ll find this:
[quote]‘– Email Send –
Const cdoSendUsingMethod = _
“http://schemas.microsoft.com/cdo/configuration/sendusing”, _
cdoSendUsingPort = 2, _
cdoSMTPServer = _
“http://schemas.microsoft.com/cdo/configuration/smtpserver”
[/quote]
What does it do? it describes as email send, but why exactly are the internet adresses of Microsoft in there?
Does it require internet connection even if you send in through intranet?
Thanks!
Joey
Its a bit strange… i think that code is required if the SMTP server is not on the local machine…
I recon they just use those internet addresses to declare the function… the machine running the script wouldn’t need to access them…
Good info here… http://www.paulsadowski.com/WSH/cdo.htm
It would be nice if the script also included a date when the log was created so that one can verify that its realy the right job and not some old one.
Hi,
I have a request to parse multiple robocopy log files stored in a folder for errorlevels using vbscript. Then write comments accordingly to an output file. I am able to loop through the folder for the files and write to an output file. However, I am not sure how I can capture the following errorlevel or errrocode from the log and process the comments accordingly. I have never done any vbscript in my life until two weeks ago. Any help on this will be greatly appreciated.
if log has errorlevel 16 write “FATAL ERROR” to output file
if log has errorlevel 8 write “FAILED COPIES” to output file
if log has errorlevel 4 write “MISMATCHES” to output file
if log has errorlevel 2 write “EXTRA FILES” to output file
if log has errorlevel 1 write “OK COPY” to output file
if log has errorlevel 0 write “NO CAHNGE” to output file
thank you.
Thank you very much, this is a very useful script. I added a line to zip the log file (my log file was upwards of 25 megs / 2M files) prior to attaching it for the email.
THanks once more for the useful script – it has saved me several times.
But I noticed that on one occasion the server which was supposed to create the file which will be robocopied to my external disk failed. So the robocopy job had nothing to copy over – in other words it skipped the file. But an email was still sent saying the the robocopy was successful. So there a way to change the script to say if there are skipped files flag them?
Thanks
Sokam
Because the actual robocopy job hasn’t failed on any files, there won’t be an error logged.
Its up to the application to alert you of any failures on its part when generating backup files…
Furthermore.. the /MIR switch can be dangerous in these situations, because it mirrors the data from the source to the destination… that’s why we should always robocopy to a destination that then gets backed up and adequately retained.
Thanks for your earlier response.
My log file is about 30MB plus can you please let me know how to add
a line in the script to zip the log file prior to attaching it for the email.
I think Zim did mentioned of doing this but no example was provided.
Thanks in advance.