Robocopy is a robust file copying program built into Windows similar to UNIX rsync. It is a much better method of copying large datasets or lots of files across volumes and is a great tool for backing up data. It has the ability to resume copies if interrupted, various options and logging during copying. Using a scheduled task can automate this, so backups are done every night, without interaction from you.
COE IT has created a script (below) that can be modified and used to your specific needs to aid graduate students who wish to have an easy way to back up files from local computer storage to external disks, or to our backup server "attic".
@ECHO OFF
SETLOCAL
SET _source=C:\temp
:: Change C:\example_source to the directory you want to copy from
SET _dest=E:\
:: Change X:\example_dest to the directory you want to copy to
SET _what=/COPY:DT /E
:: Sets specific copy instructions
:: See readme for more details
SET _options=/LOG:C:\temp\example-log
:: Log file specifications
:: See readme for more details
ROBOCOPY %_source% %_dest% %_what% %_options%
:: Starts ROBOCOPY
attrib -s -h %_dest%
:: Removes System and Hidden Attributes from copied files
Download a pre-made batch script here.
Please note that if you would like to change the name of the robocopy_example.bat file, it cannot be named "robocopy.bat", this will cause it to fail.
Advanced Users: If you have a specific way you want your files copied and want to change the options for the way the robocopy runs, refer to the ReadMe included in the .zip
Full Microsoft robocopy documentation can be found here: https://technet.microsoft.com/en-us/library/cc733145.aspx
You can create a scheduled task to automatically run your robocopy script at a specified time.
For example, scheduling it to back up your C:\work_example_directory to X:\backup_example at 6 p.m. every night
General Tab
Give your task a name and description on what it does, for the Security options, make sure that your user account is set to run the task, and that the radio button for "Run only when the user is logged on" is selected
Triggers Tab
Create a new trigger
Select when you want the task to begin, "On a schedule" is a good option to start
Change the Settings to how often you want to run the task and when (date and time) you want it to start and reoccur
Advanced settings allow some additional options
Click OK when finished to create the task
Actions Tab
Create a new action
Action: Choose "Start a program"
Settings: Program/script: "C:\temp\robocopy-example.bat"
This is telling Windows to run "C:\temp\robocopy-example.bat" in Windows command prompt. Change the path and filename inside the quotes to match where your script is located and what it is named. It is recommended to keep the path/filename short and avoid spaces.
Conditions Tab
Additional options should you choose to use them. Defaults generally are fine for most tasks.
Settings Tab
Additional options should you choose to use them. Defaults generally are fine for most tasks.