Local backup - using robocopy and scripting

Posted on 2010-09-17
Last Modified: 2012-05-10
Hi all,

I have put together a script that will run a robocopy job, then create a log file based on the date and time the job completed. I want to know if there is a way to interigrate this log file on completion and then if there are errors send an email with the errors included. If the job has no errors then send an email with backup was successful.

Does anyone know how this could be done?

Question by:ranski
  • 2
  • 2

Expert Comment

Comment Utility
Have a look here can use exit code of robocopy you have little budget for around 20 box you will get     RoboCopyPlus adds the following functionality to    Microsoft ROBOCOPY:        * Email notification on 'Success', 'Warnings' or 'Errors'.        * Log file filtering, showing only relevant information, like warnings, errors and other exceptions.        * Smart logfile attachments, e.g. on warnings or errors only.Hope it help.

Author Comment

Comment Utility
thanks, any idea how to get the below script to point a link to the latest log file rather than attach it?

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFolder = objFSO.GetFolder("c:\log\")

datNewest = #1/1/1970#

For Each objFile In objFolder.Files

  If objFile.DateLastModified > datNewest Then

    datNewest = objFile.DateLastModified

    objNewest = objFile

  End If


Set objEmail = CreateObject("CDO.Message")

objEmail.From = ""

objEmail.To = ""

objEmail.Subject = "Backup"

objEmail.Textbody = "check the attached log file.(objNewest)" 

objEmail.AddAttachment objNewest

objEmail.Configuration.Fields.Item("") = 2

objEmail.Configuration.Fields.Item("") =""

objEmail.Configuration.Fields.Item("") = 25 



Open in new window


Accepted Solution

simonseztech earned 500 total points
Comment Utility
You mean something like this ?
objEmail.Textbody = "Check this  <a href="c:\log\(objNewest)">link</a>"

Author Closing Comment

Comment Utility

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
Learn about cloud computing and its benefits for small business owners.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now