26-Dec-14 (Created: 26-Dec-14) | More in 'Computer Hardware'

A Poor, Stubborn, and Lazy approach to backup a Windows Laptop

This is very likely a poor, stubborn and lazy mans (and quite likely not a sensible woman's) approach for backing up a windows laptop to an external hard drive once in a while so that you don't loose a lot of data that is far more valuable to you than the laptop.

Basic Idea

1. Identify a handful of directories you want to back up occasionally

2. Organize your data into those directories

3. Say 5 root directories

4. Create 5 root directories in the target USB drive

5. Create a batch file in each of the directories on the USB drive

6. Each batch file copies the latest file using command line xcopy with right options. This allows you to copy only what changed and is fast.

7. Go to each sub directory and run this file as often as you want

You can use Google Drive as your target

More recently you can do this sort of thing on the google mapped drive or drop box or any cloud based drive.

Where to start

Identify your directories as


d1
d2
d3
d4
d5

Create the following directories on the target drive


some-root\backup\bin
some-root\backup\d1
some-root\backup\d2
some-root\backup\d3
some-root\backup\d4
some-root\backup\d5

Then create the following batch files


some-root\backup\bin\backup-d1.cmd
some-root\backup\bin\backup-d2.cmd
some-root\backup\bin\backup-d3.cmd
some-root\backup\bin\backup-d4.cmd
some-root\backup\bin\backup-d5.cmd

Here is a typical batch file backup-d1.cmd

Copy the following text into a batch file


@echo off

@rem this is a back up file
@rem source: 
@rem xcopy c:\someroot\d1  ..\d1 /d /s /e /L

if "%1" == "list" goto list
if "%1" == "real" goto real
if "%1" == "" goto nothing
echo list selected

:nothing
echo You have to say list or real
goto done

:list
echo Listing files that have changed
xcopy c:\someroot\d1 ..\d1 /d /s /e /L
echo listing files complete.
goto done

:real
echo real selected
echo I am going to copy the latest files from source to target
echo this may take sometime depending on the size
echo you can control-c anytime and restart if needed
xcopy c:\someroot\d1 ..\d1 /d /s /e 
goto done

:done
echo done

Key windows directories you care about


c:\users\your-user-id\my documents
c:\users\your-user-id\my pictures
c:\users\your-user-id\my videos
c:\users\your-user-id\my music
c:\users\your-user-id\favorites
c:\users\your-user-id\downloads
c:\users\your-user-id\desktop (Be careful with this one!)

And hopefully your data is rooted in a couple of directories. If not move them to that type of structure and you can do this.

How to run the batch files

Go to the bin directory in using command line and run each batch file.

DO NOT DOUBLE CLICK ON THE BATCH FILE IN YOUR UI. Instead go to the command line and run it from there.

Useful Links

1. How to use XCOPY and its options

2. Windows batch and command files