Use a Robocopy Script to Perform a Simple Backup of Windows RT Local Storage
WARNING: This procedure is still under development by the community and has received limited, informal testing. Create a copy of important data using another means before testing this procedure. Other ways of backing up local data include using File Explorer to copy your data to an external drive, or using a non-Microsoft app such as Metro Commander to perform this copy.
You can use the Robocopy command to automate copying the contents of local storage on a Windows RT device such as a Surface to a backup location, such as a USB drive or a shared folder on your network. You can also use the command to keep a folder loosely in sync with a remote location, but because Robocopy is not a synchronization tool, this solution has a number of drawbacks to be aware of, as described in the Bidirectional Copy Script section of this topic.
Both scripts below can be used on a Windows RT device by opening Notepad, copying the script commands into the text file, and then saving the file with a file extension of .cmd. You can run the script from a Windows PowerShell window or a command prompt window that you've opened with administrative permissions.
Note: For most users, File History is a better backup solution for Windows RT (including Surface) than using Robocopy. File History can backup locally stored data in your Libraries to an external USB drive or a shared folder on another computer. For more information, see http://windows.microsoft.com/en-ID/windows-8/how-use-file-history
Note: The scripts below might appear with extra line breaks due to how the code appears on this web page.
Backup Script
This script backs up a local folder and subfolders to a remote folder, such as a USB drive or a shared folder. It saves the results of the copy operation to the log file C:\backuplog.txt, appending the results to the end of the file. As a result, this log file will grow larger over time - periodically delete the file to conserve free space.
REM Copy local folder remote, not including older files
Robocopy "%userprofile%\Documents" "D:\Backup" /Copyall /e /b /dcopy:DAT /FFT /MT /log+:C:\backuplog.txt /xo /xx /it
Bidirectional Copy Script
This script can be used to keep a local folder loosely in sync with a remote folder if you are careful to only edit files in one location between running the script. This script overwrites older files, even if they've been changed - there is no conflict resolution. For example, if you edit a file on your Windows RT device, and edit the file a little later in your backup location, the (newer) file in the backup location will overwrite the file on your Windows RT device. To use this script safely, make changes to a given file only on your Windows RT device, or in your remote location, not in both locations.
As written, this script will not allow for files to be deleted - if you delete a file locally, it will get recreated from the remote copy the next time the script is run. To delete a file when using this script, you must delete the file in both the local and remote locations prior to next running the script.
The script saves the results of the copy operation to the log file C:\backuplog.txt, appending the results to the end of the file. As a result, this log file will grow larger over time - periodically delete the file to conserve free space.
REM Copy Remote folder locally, not including older files
Robocopy "\RemoteComputer\RemoteData" "C:\LocalData" /Copyall /e /b /dcopy:DAT /FFT /MT /log+:C:\backuplog.txt /xo /xx /it
REM Copy local folder remote, not including older files
Robocopy "C:\LocalData" "\RemoteComputer\RemoteData" /Copyall /e /b /dcopy:DAT /FFT /MT /log+:C:\backuplog.txt /xo /xx /it