Simple, Crude Backup Batch Script
Now, we all know how important it is to back up, right? Just realising this is the first hurdle – well done, you are already ahead of the majority of computer users. (Who will one day discover that while ignorance is bliss, it also comes with a shelf-life.) Now, actually doing it. Ideally you want to back up to two kinds of media, one of which will be in a geographically different location than your computer. A webserver would be good, but that would take just a little while, and who wants all their personal stuff over on someone else’s internet-accessible server? Burning to a CD or DVD, or saving to an external hard drive, is more realistic. Or, you can be like me and just copy from one of your internal hard drives to the other. This is really easy, and covers the most likely problem (isolated hard drive failure). Note though that it isn’t very reliable, and backing up to external media from time to time would be the smart thing to do.
I used to just use drag-and-drop, but that got old real quick, so I looked up some docs and wrote myself a batch script. Behold, bup.bat:
XCOPY "C:\dave\downloads\*.*" "E:\BACKUP_latest\dave\downloads" /e /i XCOPY "C:\dave\images\*.*" "E:\BACKUP_latest\dave\images" /e /i XCOPY "C:\dave\music\*.*" "E:\BACKUP_latest\dave\music" /e /i XCOPY "C:\dave\stuff\*.*" "E:\BACKUP_latest\dave\stuff" /e /i XCOPY "C:\Program Files\EditPlus 2\*.*" "E:\BACKUP_latest\editplus" /e /i XCOPY "C:\Documents and Settings\DB\Application Data\Mozilla\Firefox\Profiles\*.*" "E:\BACKUP_latest\firefox" /e /i REM XCOPY "C:\Documents and Settings\DB\Application Data\Thunderbird\Profiles\*.*" "E:\BACKUP_latest\thunderbird" /e /i PAUSE
The /e does subdirectories (I think of it as “everything”) and the /i will create the destination folder if necessary. Interesting options that I decided against include /D:m-d-y (Copies files changed on or after the specified date. If no date is given, copies only those files whose source time is newer than the destination time.) and /Y (Suppresses prompting to confirm you want to overwrite an existing destination file.) The Thunderbird line is commented out because I don’t have that installed at the moment, and the PAUSE is entirely optional – I just like to see everything went OK. You might want to have a look at the Microsoft documentation, although I can’t say it was a very pleasant experience.
I run this once a week on Sundays. The magic formula with regards to frequency is to think would I be okay with losing all my data since my last backup? If the answer is no, start backing up more often. Oh, and remember to keep your data in accessible formats.





what about emailing everything important to your 1gb googlemail account?
Comment by Dave — August 7, 2006 @ 5:37 pm
There seems to be no shortage of people telling me that I shouldn’t be trusting Google with my important stuff. It would be awful if they turned out to be right after we have all laughed at them so much. I do remember though when people provided code not long after Gmail’s release that allowed you to use it as a file server. Would certainly be handy if you had the bandwidth.
Comment by db — August 7, 2006 @ 11:06 pm
[...] I recently posted my simple backup script. To complete your Rambleschmack Multimedia Experience™, I’ve made a video of the backup script running and posted it on my other site. Insane, huh? Insanely good or insanely bad, though, no one’s quite sure yet. [...]
Pingback by Technology | db.rambleschmack.net — August 20, 2006 @ 9:06 pm
http://www.viksoe.dk/code/gmail.htm
gmail drive shell extension
Comment by sickley — June 2, 2008 @ 11:45 am
hey !
i need to backup my documents from another system at network, which contains data relating to accounting, i want to do backup daily automatcally and also want to make a folder after backup completes it display a folder known as the dateand time on which back-up is completed…
Please mail me @ ghoriaak@hotmail.com bcoz i really need it urgent.
Thnx…
Comment by adil — April 4, 2009 @ 7:56 pm