Backup the contents of the Windows My Documents folder to a specified destination. Requires robocopy.exe to be in the script folder (or Windows system32 folder). Download robocopy from the Microsoft website in the form of a resource kit.
This script uses Robocopy to continuously monitor the data location and backup soon after changes have been detected effectively keeping the data backed up constantly.
Set objShell = CreateObject("WScript.Shell")
Const USER_PROFILE = &H28&
Const MY_DOCUMENTS = &H5&
'Change MY_DOCUMENTS to USER_PROFILE below if desired
Set objFolder = objShell.Namespace(MY_DOCUMENTS)
Set objFolderItem = objFolder.Self
'Log to file (otherwise log to screen)
fLog = false
'Source path (data to backup)
src = objFolderItem.Path
'Destination path (backup location)
dest = "Z:Backup"
sRun = "%comspec% /c robocopy """ & src & """ """ & dest & """ /MON:1 /MOT:5 /TBD /S /MIR"
If fLog = true Then
sRun = sRun & " /XF ""BackupLog.txt"" >""" & src & "BackupBackupLog.txt"""
End If
objShell.Run sRun,2,False