Skip to content

Instantly share code, notes, and snippets.

@bensutherland
Last active June 25, 2019 17:58
Show Gist options
  • Save bensutherland/6d43309b3c6a2434b20b707b5890e524 to your computer and use it in GitHub Desktop.
Save bensutherland/6d43309b3c6a2434b20b707b5890e524 to your computer and use it in GitHub Desktop.
robocopy_archive

Backup Documents folder to Archive at MGL

How to backup your 'My Documents' folder to the network drive using robocopy.
Note: this instruction comes with absolutely no guarantees and is generally for the author only. That being said, hopefully it is useful for you, and if you see any issues, please let me know.

robocopy should already be on your machine with standard Windows installation
robocopy https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy

0. Prepare data

Make sure that all files within your My Documents folder are those that you want to back up (i.e. no confidential or personal information).

1. Create target folder

Make a new folder in the target drive where your data will be backed up to, by replacing <your_name> with your actual name:
Create the new folder within: X:\DNA_Archive3 as <your_name_backup\backup>. For example:
X:\DNA_Archive3\jane_doe\backup

2. Use robocopy to copy your files

A. Launch robocopy

Use start menu button, click search, enter 'cmd' then click cmd.exe when found.
The prompt should show C:\Users\doej, where your name is in place of 'doej'

B. Use command to save your data

Replace 'sutherlandb' with your username, and with the correct folder name within the path.
robocopy /r:0 /w:0 /s /e /np /copy:DAT /log:X:\DNA_Archive3\sutherlandb_backup\backup_2019-06-25.log C:\Users\sutherlandb\Documents\ X:\DNA_Archive3\sutherlandb_backup\backup\

Flags explained:

/r = Specifies the number of retries on failed copies. The default value of N is 1,000,000 (one million retries).
/w = Specifies the wait time between retries, in seconds. The default value of N is 30 (wait time 30 seconds).
/s = Copies subdirectories. Note that this option excludes empty directories.
/e = Copies subdirectories. Note that this option includes empty directories. 
/np = Specifies that the progress of the copying operation (the number of files or directories copied so far) will not be displayed.
/copy = Specifies the file properties to be copied. The following are the valid values for this option:
        D Data
        A Attributes
        T Time stamps
/log = Writes the status output to the log file (overwrites the existing log file).

3. Confirm your data

After the job finishes, take a quick look to see that your data is all there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment