Simple Backup

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
cd /home/yourusername/documents
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 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
and press enter. then to run it you can either doubleclick it in the file browser, or type ./ from the command line if you’re in the directory that you’ve saved it.

Related Posts

Blog Traffic Exchange Related Posts
  • Using the command line in linux - part 2 This is part two in a series of "how to use the command line in linux" style articles.... these are intended to be quite basic for those that have not used a command line before.... In part one we logged in (if necessary) and found out about the help command,......
  • 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......
  • 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......
Blog Traffic Exchange Related Websites
  • How to Enable Show Hidden Files and Folders Some malware can modify Windows settings to disable or prevent users to change setting of Show Hidden Files and Folders under folder options. These steps will help you regain access or modify and save the settings. PROCEDURE A: 1 . Go to Start > Run 2. Type regedit on the......
  • 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......
  • Turn Any File into an EXE with Convert to EXE If you're a geek like me, you may on occasion have run into a situation where you had a file that you needed to convert to exe. I had read a few forum posts and tutorials on how to do this with self-extracting installers, and I even managed to do......    Send article as PDF   

Similar Posts

See what happened this day in history from either BBC Wikipedia
Amazon Logo

Comments are closed.

Switch to our mobile site