Windows – Robocopy

Last updated on March 6th, 2019 at 07:47 am

Network Copy

robocopy "\\\folder\folder2018\Rental" "D:\Class Rental" /ZB /E /NP

Local Copy

robocopy "D:\folder\folder2018\Rental" "D:\Class Rental" /ZB /E /NP


Batch File

@echo off

del C:\Daily-BCKP\Data-BCKP-Log.txt
robocopy "D:" "\\server\share_folder$" /E /ZB /xo /NP /NFL /NDL /R:3 /xd "dfsrprivate" "$RECYCLE.BIN" "System Volume Information" >>C:\Daily-BCKP\Data-BCKP-Log.txt
wscript "C:\Daily-BCKP\BCKP-Email-Notification-Data.vbs"


Set objMail = CreateObject("CDO.Message")
Set objConf = CreateObject("CDO.Configuration")
Set objFlds = objConf.Fields
objFlds.Item("") = 2 'cdoSendUsingPort
objFlds.Item("") = "" 'your smtp server domain or IP address goes here
objFlds.Item("") = 25 'default port for email
'uncomment next three lines if you need to use SMTP Authorization
'objFlds.Item("") = "your-username"
'objFlds.Item("") = "your-password"
'objFlds.Item("") = 1 'cdoBasic
objMail.Configuration = objConf
objMail.From = "[email protected]"
objMail.To = "[email protected]"
objMail.Subject = "Backup Data to ILFile01BCKP"
objMail.TextBody = "Please Check Event Attached"
objMail.AddAttachment "C:\Daily-BCKP\Data-BCKP-Log.txt"
Set objFlds = Nothing
Set objConf = Nothing
Set objMail = Nothing

Create scheduled task and run your batch file only!