One of the things that really surprised me about the February 22nd Christchurch earthquake was hearing that some businesses had not bothered to take the simple and cheap step of backing-up their data offsite. Their only data was sitting on a computer or server, either crushed under rubble or inaccessible behind security cordons. What was the data? Speadsheets, MYOB files, Addressbooks, Payroll records, Tax files, you name it – all totally unusable.
I thought about my own rather haphazard backups too.
After some experimentation I came up with the bach file cut-and-pasted below, which lives on a USB memory stick and backs up my data onto the stick with the minimum of fuss.
————————————————————————————–
@echo off
REM By David Fraser. Released 7th April 2011. Email address: zl3ai@qsl.net
REM Put this batch file on the removable drive that you wish to back up data onto.
REM Define which files are to be backed up, and where they will be copied to.
set BackupSource=C:\Documents and Settings\*.*
set BackupDestination=Backup files
REM Display source and destination so user can confirm.
echo Source: %BackupSource%
echo Destination: %BackupDestination%
echo.
echo Press Ctrl-C to abort, or
pause
echo.
echo Please wait . . .
REM Use XCOPY to do the actual copying of files.
xcopy /D /E /I /Y “%BackupSource%” “%BackupDestination%”
REM Here is some documentation for XCOPY if you wish to customise the command line.
REM
REM Copies files and directory trees.
REM
REM XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
REM [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U]
REM [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z]
REM [/EXCLUDE:file1[+file2][+file3]…]
REM
REM source Specifies the file(s) to copy.
REM destination Specifies the location and/or name of new files.
REM /A Copies only files with the archive attribute set,
REM doesn’t change the attribute.
REM /M Copies only files with the archive attribute set,
REM turns off the archive attribute.
REM /D:m-d-y Copies files changed on or after the specified date.
REM If no date is given, copies only those files whose
REM source time is newer than the destination time.
REM /EXCLUDE:file1[+file2][+file3]…
REM Specifies a list of files containing strings. Each string
REM should be in a separate line in the files. When any of the
REM strings match any part of the absolute path of the file to be
REM copied, that file will be excluded from being copied. For
REM example, specifying a string like \obj\ or .obj will exclude
REM all files underneath the directory obj or all files with the
REM .obj extension respectively.
REM /P Prompts you before creating each destination file.
REM /S Copies directories and subdirectories except empty ones.
REM /E Copies directories and subdirectories, including empty ones.
REM Same as /S /E. May be used to modify /T.
REM /V Verifies each new file.
REM /W Prompts you to press a key before copying.
REM /C Continues copying even if errors occur.
REM /I If destination does not exist and copying more than one file,
REM assumes that destination must be a directory.
REM /Q Does not display file names while copying.
REM /F Displays full source and destination file names while copying.
REM /L Displays files that would be copied.
REM /G Allows the copying of encrypted files to destination that does
REM not support encryption.
REM /H Copies hidden and system files also.
REM /R Overwrites read-only files.
REM /T Creates directory structure, but does not copy files. Does not
REM include empty directories or subdirectories. /T /E includes
REM empty directories and subdirectories.
REM /U Copies only files that already exist in destination.
REM /K Copies attributes. Normal Xcopy will reset read-only attributes.
REM /N Copies using the generated short names.
REM /O Copies file ownership and ACL information.
REM /X Copies file audit settings (implies /O).
REM /Y Suppresses prompting to confirm you want to overwrite an
REM existing destination file.
REM /-Y Causes prompting to confirm you want to overwrite an
REM existing destination file.
REM /Z Copies networked files in restartable mode.
REM
REM The switch /Y may be preset in the COPYCMD environment variable.
REM This may be overridden with /-Y on the command line.
REM Display how much space is left after backing up. Must not be zero. Worry if it is a low value.
echo.
dir | find “free”
REM Finished
echo.
echo Backing-up finished.
REM Remove environment variable values
set BackupSource=
set BackupDestination=
REM Stop so that user can see the results
pause
—————————————————————————————
Filed under: Computer, Earthquake | Leave a Comment »