This is going to explain some ideas for a really simple way to make your own backup routine.
This isn’t very fancy and in some ways it’s not the best backup solution. Let me explain what to use this for. This kind of tool can be used to “save you from yourself.” For example…. “oops I wrote over my … file”.
One solution that I’ve come up with under windows or linux is a simple batch or command script. Most computer users today have sweaty palms when they see that black screen with a little white command prompt, but it does hold great simplicity and flexibility.
Under windows. Let’s say I want to copy a file from My Documents to a folder called backups. Open up a command shell in the My Documents folder (this may be the hardest part. You may need to navigate to the My Documents folder through the command line which can be a little tricky. That might be worth another article.)
If your prompt does show that your in the right folder you can type dir to get a listing of the folder. It may be a long list, but let’s say your file is called myfile and it’s a word document, (so it’s probably really called myfile.doc). Then typing the following
copy myfile.doc backupmyfile.doc
That should put a copy of the said file in your backup directory. now this assumes you had already created that backup directory and it was in the My Documents folder. So how can we automate this? Open up notepad. No, not word, notepad. (Start, Run… notepad.) type the commands that you needed to get to the My Documents folder, then type the copy command that you used. Go to file and then save, choose ALL file types and save as mybatchfile.bat (It’s important to have ALL file types set or it will add .txt to the end which will prevent it from being run.)
Now you might save it My Documents if you like (then you won’t have to include the navigation to the My Documents folder).
Now browse to My Documents and find mybatchfile – doubleclick it. It may flash by quickly, but it may be stopped to ask a question. That’s because the copy command is usually reluctant to overwrite a file, so if your myfile.doc exists in the backup folder we need to tell it to overwrite. Open the file back up in notepad and where you have
copy myfile.doc backupmyfile.doc
add this to the end of the line /Y so that it looks like this.
copy myfile.doc backupmyfile.doc /Y
This should tell the copy command to answer Yes to the overwrite question. Save and close again and test the batch file.
You can use this with multiple files as well. The big thing to notice is this…. this will not protect your data against a hard drive failure since the backup is stored on the same drive as the original data. It might give you a safety net for when “word eats your homework..”
Under linux the commands are a bit different. Open any text editor. we’ll assume that your file is in /home/yourusername/documents. Let’s make sure the script is started out right.
Put the following in your new text document
cp myfile.doc ./backup/ -f
That’s it. I’ve condensed the steps here a bit since I’ve explained things a bit more for the Windows folks. For starters under linux scripts need to be told how to be interpreted. There are perl scripts/php etc. This is going to be using the bash shell and that’s what the first line sets. The second line navigates to the directory where your file is. Third line is linux’s copy command (cp) and the -f at the end “forces” the copy to take place even if the file already exists there. Of course, here again we’re assuming you’ve already created a backup folder under /home/yourusername/documents
Save and close from the file, let’s name it myscript.sh under linux the filename doesn’t have any bearing on whether or not it can be executed, I just like tagging shell scripts with the .sh ending to visually sort them. We do need to make sure we can run it though. In konqueror (if you use kde) you can navigate to where you saved the script, right click and go to properties and set it executable. Other gui’s should give you similar possibilities. Of course, you can drop to the command line and navigate to the file’s directory, then type
chmod +x myscript.sh
and press enter. then to run it you can either doubleclick it in the file browser, or type ./myscript.sh from the command line if you’re in the directory that you’ve saved it.
Related PostsRelated Posts
- How to Remove Windows System Defender | Removal Guide Windows System Defender is a new rogue antivirus software along the lines of Windows PC Defender (See the Windows PC Defender Removal guide) (I believe it's the same family of malware.) It claims to be a powerful and effective antivirus and antispyware suite, but will overwhelm you with warnings and......
- Recovering a Split BiggieFile from a MondoRescue Backup Once upon a time I wrote of manually extracting a file from a mondorescue backup. Sometimes it's just easier to do that, than have mondorescue go through 30 some cds or dvds just to find one file. (Not to mention the fact that the iso's aren't burned to disc but......
- Adobe Reader 8.1 has Encountered an Error and Needs to Close So, the adobe reader version 8.1 should be a straightforward install. On one particular XP system it wasn't and from what I can tell, there are several that have run into the same problem. The installer seems to work well enough, but when I try to launch the application I......
- Wordpress Backup Wordpress Backup is an essential plugin for all Wordpress blog administrators by the Blog Traffic Exchange. It performs regular backups of your upload (images) current theme, and plugin directories. Backup files are available for download and optionally emailed to a specified email. Don't get caught without a recent backup of......
- Home Office Ideas Home working has reached a level where it has once again become a major part of the economy. It is especially big in Europe. For example, approximately 4 million residents in the UK work from home necessitating the need to optimise their office spaces in order to improve efficiency, while......
- 5 Common Tax Mistakes You Shouldn’t Be Making With just over a month to go before the Tax Man comes around, many consumers are scrambling to get their receipts and W-2s in order so they can file their online taxes and hopefully get a nice refund check. With so many people in such a mad rush to......
- Using the command line in linux – part 2
- Another workaround for WMF exploit
- Recovering a Split BiggieFile from a MondoRescue Backup
- Backing up and restoring MySQL databases
- Rsync for easy (and quick) backups