Overclock.net › Forums › Overclock.net Forum › FAQs › How to: Automatically Backup Files
New Posts  All Forums:Forum Nav:

How to: Automatically Backup Files

post #1 of 4
Thread Starter 
Being a computer enthusiast is both a blessing and a menace. We constantly change components and reap the performance benefits, but we're stuck with the time consuming tasks of backing up and recovering our important data in the new setup. After going through 6 reformats in the past 4 months, I've decided to take the effort out of the process. It's a bit more work to start, but afterwards, a simple click of a button (or scheduled task) can back up any and every file you wish.

Problems with manual backup:

- Because it's on a file-by-file basis, it's sometimes difficult to make sure you've included everything everytime
- It's difficult to remember where all the backed-up files were originally located (save game files in particular) when you go to restore them
- It's time consuming

The solution:

1) xcopy command
2) .BAT file
3) Windows task scheduler


xcopy Command

xcopy is a command-line function built into Windows that can be used to copy files/directories in a wide variety of ways. A full explanation can be read here.

For the purpose of this guide, I'll be doing seperate xcopy commands for each file/directory so that I can easily add/remove the backup of any given element. I am also using the /e parameter to include all empty directories, and the /y parameter to eliminate the "Overwrite files?" prompt.

Notes: When using xcopy, I've found it works best when you leave the \\ off of your source and be sure you include the \\ on your desination. This basically ensures you copy everything within the source directory, and ensures that your destination is a directory, not a file. You'll also want to surround all paths with " " to ensure the argument is read as a single string (if there are spaces in the path you must use quotes).


Code:
xcopy /e /y "C:\\Source" "C:\\Dest\\"
This command will yield a directory in C:\\ named Dest, and it will contain all files and subdirectories from Source.

For my backup method, I'll be copying to a different hard disk, but I'd like to keep the same path as the original. Why not just put it all in one folder? It's basically a preference thing. If I keep all the original paths intact, I just have to drag a single backup folder onto my freshly re-installed Windows. All the backed-up files will go back to their original places, with all directories and structures in place (very useful for saved game backups or custom configurations. It's a pain to locate all the save folders every time).

The model I use:

Code:
xcopy /e /y "C:\\Program Files\\Game1\\Saves" "X:\\Program Files\\Game1\\Saves\\"
Even though I'll have two tiers of useless directories (Saves is the only one that's really needed) the other directories act as placeholders and keep the original filepath intact.


.bat File

A batch (.bat) file is a basically a list of commands to be executed. For this guide, I'll be using a batch file as a means to execute a series of xcopy commands that correspond to my different files. This is both the easiest and hardest part. Easiest because you just have to put repeated xcopy commands, hardest because any files you don't include in your batch file, won't get backed up. You have to be absolutely sure you include all important items in your list of xcopy commands.

Code:
xcopy /e /y "C:\\Documents" "D:\\Documents\\"
xcopy /e /y "C:\\Music" "D:\\Music\\"
xcopy /e /y "C:\\Saves" "D:\\Saves\\"
After you have your full list of backup commands, save it under whatever name you'd like, but include a .bat extension. For simplicity, I used backup.bat.


Windows task scheduler



With the creation of your new backup batch file, you can use the Windows task scheduler to run a backup on a regular, scheduled basis. Here's how...

1) Control Panel -> Scheduled Tasks
2) Click "Add Scheduled Task"
3) Click "Next" and then "Browse" and find your backup batch file.
4) Set up the times that you want the task to run and you're finished.


Now, you'll have backups of anything you deem important, as often as you deem important. You can add and remove files at any time by simply editing your batch file. Hopefully someone can put it to good use, and save some headaches and lost work.

Restoration

After backing up all your files, you can easily make another file, restore.bat, with the source and destination drives reversed (ie. copying from D:\\ to C:\\). By running restore.bat file with a freshly formatted drive, you're able to put everything back in their original places. However, as mentioned before, I always backup to the exact same path as the original, so that all I have to do is drag the backed up files onto my C:\\ and everything gets copied to the correct place.


Disclaimer:
As with all FAQ's, this is meant as a guide only. Myself and Overclock.net shall not be responsible for any undesired effects as a result of the procedures described in this guide.
RAID0R
(14 items)
 
  
CPUMotherboardGraphicsRAM
i5 750 4.0GHz MSI P55-GD80 GTX 470 | 8800GT PhysX 2x2GB G.Skill Ripjaws 
Hard DriveOptical DriveCoolingOS
60GB Agility 2|1TB RAID0|1.5TB Pioneer DVR-217D XSPC Raystorm | XSPC RX240 Windows 7 Professional x64 
MonitorKeyboardPowerCase
27" Dell 2709W | 17" Samsung Logitech G15 Corsair HX850 Corsair 650D 
Mouse
Microsoft IntelliMouse 
  hide details  
Reply
RAID0R
(14 items)
 
  
CPUMotherboardGraphicsRAM
i5 750 4.0GHz MSI P55-GD80 GTX 470 | 8800GT PhysX 2x2GB G.Skill Ripjaws 
Hard DriveOptical DriveCoolingOS
60GB Agility 2|1TB RAID0|1.5TB Pioneer DVR-217D XSPC Raystorm | XSPC RX240 Windows 7 Professional x64 
MonitorKeyboardPowerCase
27" Dell 2709W | 17" Samsung Logitech G15 Corsair HX850 Corsair 650D 
Mouse
Microsoft IntelliMouse 
  hide details  
Reply
post #2 of 4
I am suprised no one has commented yet, this should serve me well thanks!
MG/3D Rig
(15 items)
 
  
CPUMotherboardGraphicsRAM
I7-930@3.8 Evga x58 SLI LE BFG Geforce GTX 280 H2OC Mushkin 3x4GB DDR3 1333 
Hard DriveOptical DriveCoolingOS
Seagate 320gb 7200.11 Dual DVD/DVDRW XSPC Rasa / 3T Coolingworks / D5 Windows 7 x64 Pro 
MonitorKeyboardPowerCase
Doublesight DS-263N 26" Logitech Access Corsair HX 650W Antec P180 
MouseMouse PadAudio
Logitech G5 Steelpad QcK+ Auzentech Prelude 
  hide details  
Reply
MG/3D Rig
(15 items)
 
  
CPUMotherboardGraphicsRAM
I7-930@3.8 Evga x58 SLI LE BFG Geforce GTX 280 H2OC Mushkin 3x4GB DDR3 1333 
Hard DriveOptical DriveCoolingOS
Seagate 320gb 7200.11 Dual DVD/DVDRW XSPC Rasa / 3T Coolingworks / D5 Windows 7 x64 Pro 
MonitorKeyboardPowerCase
Doublesight DS-263N 26" Logitech Access Corsair HX 650W Antec P180 
MouseMouse PadAudio
Logitech G5 Steelpad QcK+ Auzentech Prelude 
  hide details  
Reply
post #3 of 4
Good help is rarely shown gratitude!

Great info C-bro.......thanks!
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
AMD Athlon 64 3000+ Asus A8V- deluxe ATI Radeon 9250 128mb 2 x 1g DDR400 (pc3200) 
Hard DriveOSMonitorKeyboard
seagate 320g SATA Windows XP Pro SP2 64bit My trusty 17" CRT DV logitech multimedia 
PowerCaseMouse
cheapo 400w PSU usicase window logitech optical 
  hide details  
Reply
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
AMD Athlon 64 3000+ Asus A8V- deluxe ATI Radeon 9250 128mb 2 x 1g DDR400 (pc3200) 
Hard DriveOSMonitorKeyboard
seagate 320g SATA Windows XP Pro SP2 64bit My trusty 17" CRT DV logitech multimedia 
PowerCaseMouse
cheapo 400w PSU usicase window logitech optical 
  hide details  
Reply
post #4 of 4
Thread Starter 
Thanks for reading guys. Hopefully it helps you out. I added a bit more to it now.
RAID0R
(14 items)
 
  
CPUMotherboardGraphicsRAM
i5 750 4.0GHz MSI P55-GD80 GTX 470 | 8800GT PhysX 2x2GB G.Skill Ripjaws 
Hard DriveOptical DriveCoolingOS
60GB Agility 2|1TB RAID0|1.5TB Pioneer DVR-217D XSPC Raystorm | XSPC RX240 Windows 7 Professional x64 
MonitorKeyboardPowerCase
27" Dell 2709W | 17" Samsung Logitech G15 Corsair HX850 Corsair 650D 
Mouse
Microsoft IntelliMouse 
  hide details  
Reply
RAID0R
(14 items)
 
  
CPUMotherboardGraphicsRAM
i5 750 4.0GHz MSI P55-GD80 GTX 470 | 8800GT PhysX 2x2GB G.Skill Ripjaws 
Hard DriveOptical DriveCoolingOS
60GB Agility 2|1TB RAID0|1.5TB Pioneer DVR-217D XSPC Raystorm | XSPC RX240 Windows 7 Professional x64 
MonitorKeyboardPowerCase
27" Dell 2709W | 17" Samsung Logitech G15 Corsair HX850 Corsair 650D 
Mouse
Microsoft IntelliMouse 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: FAQs
Overclock.net › Forums › Overclock.net Forum › FAQs › How to: Automatically Backup Files