Windows – Robocopy

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

Network Copy

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

Local Copy

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

Beckup

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"

Wscript

Set objMail = CreateObject("CDO.Message")
Set objConf = CreateObject("CDO.Configuration")
Set objFlds = objConf.Fields
objFlds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'cdoSendUsingPort
objFlds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "123.123.123.125" 'your smtp server domain or IP address goes here
objFlds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 'default port for email
'uncomment next three lines if you need to use SMTP Authorization
'objFlds.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "your-username"
'objFlds.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "your-password"
'objFlds.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'cdoBasic
objFlds.Update
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"
objMail.Send
Set objFlds = Nothing
Set objConf = Nothing
Set objMail = Nothing

Create scheduled task and run your batch file only!

🙂
Enjoy