Tuesday, 22 March 2016

Backup to OneDrive

OneDrive, out of the box, is very focussed on making your files available across all your devices; but what if you just want to use it as a cloud backup?

A little bit of scripting will come to your rescue. I'm sure the same could be done with PowerShell, but I'm an old die-hard .bat user when the opportunity arises!

Create a new batch file, and set up robocopy to copy all the files you want to back up to the OneDrive directory located under your user directory (e.g. C:\Users\Fred\OneDrive). Even if you want to back up your entire data volume you will want to exclude directories like System Volume Information and the Recycle Bin because they can cause sharing violations; so use the robocopy /xd syntax. I also found that the /fft switch prevented files being missed due to slight timestamp differences.

Once you're done, save that file out with a .bat extension, and you're good to go.

I've created a menu shortcut and run the backup manually a few times a week. The file copies everything to the local OneDrive directory and then it's down to how quick your upload speed is.

Now you just need to configure OneDrive itself. Open the Settings dialogue. On the Settings tab, make sure 'Start OneDrive automatically when I sign into Windows' is ticked and 'let me use OneDrive to fetch any of my files on this PC' is unticked.' One the Account tab click Choose Foilders, and make sure that the selected directories are as near as possible to the structure you're actually going to back up (although as the batch file will be doing the pushing it's not too essential).

Click OK to exit the OneDrive settings, and you're good to go with your online cloud backup of up to 15Gb. (You did claim your full 15Gb didn't you).

No comments:

Post a Comment