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
- A closer look at x11vnc I've got to say, one of the things I really like about linux are the myriad of options for remotely administering a system. SSH is the one I use the most, but for the graphical you have x (especially on the LAN), nxserver (which is a compressed and optionally encrypted......
- 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......
- 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......
- Washing Windows 101 Washing windows is one of those household chores that no really looks forward to. But cleaned windows can really give the appearance of your home, both inside and out, a boost. If you've been spraying window cleaner and rubbing away with paper towels, or hosing off those upper floor windows,......
- Eco-living Tips - Reduce Paper Usage It is easy to cut back on paper at home and work! > Send digital greeting cards. Everyone loves to receive a card. It's a sign of affection and thoughtfulness, yet the greeting card business uses a lot of paper. Go digital for your cards. I did at Christmas time,......
- 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