Automatically Backing Up Saved Files
So I do a bit of writing, not just for my many websites, but I'm working on a novel and a couple of screenplays. Needless to say they're a lot of work. Discounting the research and ideas the novel (according to my Celtx Tools global word count) comes in just over 65,000 words. A lot of effort I have no wish to lose.
I could (and do) backup locally, but there are plenty of online backup services that give me some off site piece of mind (what happens if someone steals all my computer gear or the house burns down?). Text files are small and there are plenty of services who offer free options so you don't even have to splash any cash. My preference, for the moment at least, is Dropbox.
It's the nicest of the implementations I've seen, it can sync to multiple computers (so you can work on more than one machine and have local backups on those machines too) and it even offers version history.
Now, I'm somewhat paranoid when it comes to my files and data, I don't like trusting it to other people as I've written before. That doesn't mean I can't put files online, it just means I need them to be secure. Just because whichever company says it's safe, scout's honour, doesn't mean it is. So I encrypt my files before I load them.
Needless to say, this could get pretty tedious, so I wrote a small batch file to do it for me, but it only handled one file and needed to be triggered manually (using AutoHotKey and a key combination). A couple of weeks ago I did some digging and found an application that would monitor the folder I save my work into and then trigger the script, passing the file to encrypt and upload. The new approach consists of three parts:
- AxCrypt to encrypt the files
- Directory Monitor to watch the folder and trigger the batch file
- A batch file to take the file passed by Directory Monitor and run AxCrypt
Directory Monitor watches a designated folder (or folders) and I've set mine to trigger when any file is added, renamed or updated. This calls the batch script and passes the file that has changed, the batch file then calls AxCrypt which encrypts the file and drops it into the local Dropbox folder and the Dropbox client uploads the file.
The reason for using AxCrypt is that it works on the command line and allows you to create self-extracting files which just need a password to open, so you don't have to worry about installing AxCrypt to open them on other machines or in the future.
Set it up
If you'd like something like this for yourself, here's how to set it up:
1. Sign up for Dropbox and download their client
Head on over to the Dropbox site and download their software, it will ask if you want to create an account or use an existing one.
2. Download and install AxCrypt
Go to the AxCrypt site, download and install. Make a note of where you install it to, you'll need it later (e.g. C:program filesaxantumaxcrypt)
3. Download and install Directory Monitor
Download Directory Monitor and install it.
4. Download and modify the batch file
Grab a copy of my batch file here, save it somewhere you'll remember where it is and then open the file in a text editor (like Notepad) and update the following values:
- Change "YourPasswordHere" on line five to whatever password you want to use on the encrypted files (you'll need this to open them in the future). E.g. mysupersecretpassword123
- If you installed AxCrypt to somewhere other than C:program filesaxantumaxcrypt update line six to path the AxCrypt.exe file is located.
- Change "LocalDropboxFolder" on live seven to the location of the Dropbox folder (or the folder inside your Dropbox folder) to save the encrypted files (typically this is inside your My Documents/Documents folder. E.g. C:UsersYouDocumentsMy DropboxDocumentsWriting
It should end up something like this:
So with that done, we just need to set up Directory Monitor to watch the folder(s) and trigger the script.
Select Add from the Directories menu in Directory Monitor and pick the folder you want to watch using the browse (ellipses) button. Deleted files are obviously hard to encrypt, so untick that option. You can do subdirectories as well on Directory Monitor, tick or untick as you wish.
Next find the box to select the script you want to execute on a change and select the batch file (remember where you saved it?).
Under File, select Options and I'd suggest ticking "Start minimized" and "Do no show update notifications" and unticking balloon tips, tool tips, you could also untick the option to check for updates. Hit Save once you're done and tha's it. Give it a test!
The only other thing to do is to add it to your startup folder so it launches whenever you turn on the machine. To do that, find the application on your start menu and then right-click the folder it is in and select open, copy the file called "Directory Monitor" (the application launcher) and if you go up a level (use the Up button in explorer or click on Programs in the address bar in later versions of Windows) and in the Programs folder you should find a Startup folder, open it and paste a copy of the file into it. This should now run when Windows starts.