I have to say I've completely overlooked a CMD command called robocopy for my backup procedure!!
It's quite amazing.
I've created a W Drive Backup.cmd file (W Drive Backup can be any filename you like) and wrote up this little beaut. One click and it runs the copy with options via the switches. I just need to find a program that can run this every hour or so.
Just don't name the file robocopy.cmd or you're in for a world of pain resulting in a continous loop of the .cmd file.
For the schedule, windows built-in 'Task Scheduler' will probably do the trick to start it upon login and the /MON:n AND /MOT:m switches will monitor changes and by time. Please refer to code for these two switches.
REM title Backing Up Made Easy. [%~nx0] by 3dwannab
@ECHO off
SET SOR_PATH1=W:
SET DES_PATH1=Z:\Backups\Drive W Backup
Start /Min "JOB: %DES_PATH1% Job" robocopy "%SOR_PATH1%" "%DES_PATH1%" /MON:50 /MOT:30 /XO /MIR /FFT /Z /XA:H /R:10 /W:10 /MT:5 /XD "$RECYCLE.BIN" "System Volume Information" /XF "thumbs.db"
attrib -s -a -h "%DES_PATH1%"
::::::::::::::::::::::::::::::::::::::::
SET SOR_PATH2=C:
SET DES_PATH2=Z:\Backups\Drive C Backup
Start /Min "JOB: %DES_PATH2% Job" robocopy "%SOR_PATH2%" "%DES_PATH2%" /MON:50 /MOT:60 /XO /MIR /FFT /Z /XA:H /R:10 /W:10 /MT:5 /XD "$RECYCLE.BIN" "System Volume Information" "*Windows*" "*microsoft*" "*dropbox*" "nvidia" "temp" "C:\Windows" "C:\ffmpeg" "C:\PerfLogs" "C:\Python34" "C:\Swsetup" "C:\temp" /XF "C:\*" "thumbs.db" "*.thumb" "*.bak" "*.sv$"
attrib -s -a -h "%DES_PATH2%"
REM @pause
:: More Info here:
:: https://social.technet.microsoft.com/wiki/contents/articles/1073.robocopy-and-a-few-examples.aspx
:: https://ss64.com/nt/robocopy.html
:: NOTES
:: ---------------------------------
:: start /min runs robocopy in minimised mode.
:: /MT[:n] where n = no. of threads being used.
:: /MIR specifies that Robocopy should mirror the source directory and the destination directory. Note that this will delete files at the destination if they were deleted at the source.
:: /FFT uses fat file timing instead of NTFS. This means the granularity is a bit less precise. For across-network share operations this seems to be much more reliable - just don't rely on the file timings to be completely precise to the second.
:: /Z ensures Robocopy can resume the transfer of a large file in mid-file instead of restarting.
:: /XA:H makes Robocopy ignore hidden files, usually these will be system files that we're not interested in.
:: /R:<n> Specifies the number of retries on failed copies. The default value of n is 1,000,000 (one million retries max).
:: /W:<n> Specifies the wait time between retries, in seconds. The default value of n is 30 (wait time 30 seconds).
:: /MON:n : MONitor source; run again when more than n changes seen.
:: /MOT:m : MOnitor source; run again in m minutes Time, if changed.
:: EXAMPLES
:: ---------------------------------
:: #8 Mirror directory excl. deletion
:: To mirror the directory "C:\directory" to "\\server2\directory" excluding \\server2\directory\dir2" from being deleted (since it isn't present in C:\directory) use the following command:
:: Robocopy "C:\Folder" "\\Machine2\Folder" /MIR /XD \\server2\ directory\dir2"
:: Robocopy can be setup as a simply Scheduled Task that runs daily, hourly, weekly etc. Note that Robocopy also contains a switch that will make Robocopy monitor the source for changes and invoke synchronization each time a configurable number of changes has been made. This may work in your scenario, but be aware that Robocopy will not just copy the changes, it will scan the complete directory structure just like a normal mirroring procedure. If there are a lot of files & directories, this may hamper performance.
Basic explanation of code shown after :: in code above with resource links.
This will back up my W Drive (Work Folder) and C Drive with a few omissions as you can see.
The only thing I'll change after the initial backup is the thread count of the copies to maybe 6 so it's less in your face when running every hour.
If you want to autoclose the CMD delete the @pause or block it by adding :: to it like so ::@pause