A simple backup script: bu.cmd
Submitted by ross on Tue, 02/17/2004 - 21:08
I've tried many of the backup solutions available, both freeware and commercial. None of them worked for me.
I finally decided to write a simple backup script to backup files using RAR and NTBackup.
It's available here.
Instead of trying to explain it, I'll let bu.cmd speak for itself:
C:\>bu
Syntax:
bu.cmd [options] <sources ...> <destination>
<sources ...> is one or more filespecs to backup.
If <sources> is a single letter (c, d, etc.), then assume c:\, d:\, etc.
NTBackup also accepts 'systemstate'.
<destination> is the directory to store the backup file to.
Options:
-t | --type type Backup type
full: Full backup (default)
diff: Differential backup
incr: Incremental backup
copy: Full copy backup
-f | --filename filename Use filename.[rar|bkf|zip] as backup file name
-u | --unique Use unique backup file name (1.rar, 2.rar, etc)
-l | --label "label" Assign "label" as a comment for this backup
(incompatible with --password)
-d | --date Save backup in a directory named yy-mm-dd
-i | --time Save backup in a directory name hh_mm_ss
-y | --sysdir Save backup in a directory of the system's name
-s | --system systemname Use systemname instead of %COMPUTERNAME%
-b | --method Set backup method
rar: Use WinRar (default)
ntbackup: Use NTBackup
zip: Use WinZip (unimplemented)
-c | --compress mode Compression method (ntbackup method only)
rar: Use WinRar on NTBackup .bkf file
zip: Use WinZip on NTBackup .bkf file (unimplement
ed)
none: Do not compress (default)
-x | --exclude filespec Filename or path to exclude (rar only)
-p | --password password Encrypt backup with password (rar only)
-v | --maxsize megabytes Maximum backup file size (rar only)
(limit: 1 source per drive)
-m | --compressionlevel n Set commpression level (1-5) (default=3) (rar only)
-o | --option option Pass option to backup program (ntbackup, rar, etc.)
Examples (on a system named durga)
bu c z:\
Backup c:\ to z:\durga_full_03-03-08_12-34-56_c.rar
bu -t diff -f root c d z:\ex
Backup c:\ to z:\ex\root_c.rar and d:\ to z:\ex\root_d.rar
bu -t diff -f bin c:\bin d:\bin z:\backups
Backup c:\bin to z:\backups\bin_c.rar and d:\bin to z:\backups\bin_d.rar
bu -d -f root c d z:\
Backup c:\ to z:\03-03-08\root_c.rar and d:\ to z:\03-03-08\root_d.rar
bu -d -i -f root c z:\
Backup c:\ to z:\03-03-08\12_34_56\root_c.rar
bu -d -i -y -f root c z:\
Backup c:\ to z:\03-03-08\12_34_56\DURGA\root_c.rar
bu -y c z:\
Backup c:\ to z:\DURGA\durga_full_03-03-08_12-34-56_c.rar
bu -b ntbackup c d systemstate z:\
Backup c:\, d:\ and systemstate to z:\durga_full_03-03-08_12-34-56.bkf
bu -b ntbackup -c rar c z:\
Backup c:\ and compress to z:\durga_full_03-03-08_12-34-56.bkf.rar
»
- ross's blog
- Login or register to post comments

service error?
This seems to be a great solution to my backup woes, however, I am getting the following error:
C:\>bu -b ntbackup c v:\
_bucompress =none
_bucompressionlevel=
_budate =
_buexcludes =
_bufilename =
_bulabel =
_bumaxsize =
_bumethod =ntbackup
_buoptions =
_buparams = "c"
_bupassword =
_busysdir =
_busystem =MJD6
_butime =
_butype =normal
_buunique =
_bu_drive =
_bu_path ="v:\"
_bu_file ="MJD6_full_05-08-25_10-55-11"
_bu_ext =bkf
_bu_file_ext ="MJD6_full_05-08-25_10-55-11.bkf"
_bu_fullpath ="v:\MJD6_full_05-08-25_10-55-11"
_bu_fullpath_ext ="v:\MJD6_full_05-08-25_10-55-11.bkf"
_buhhmmss =10-55-11
_bu_fixed_paths =!_bu_fixed_paths! !_rv!
_bupaths =!_bupaths! !_rv!
_butyp =full
_buyymmdd =05-08-25
The service name is invalid.
More help is available by typing NET HELPMSG 2185.
The service name is invalid.
More help is available by typing NET HELPMSG 2185.
ntbackup backup !_bu_fixed_paths! !_rv! /f "v:\MJD6_full_05-08-25_10-55-11.bkf"
/j "MJD6 !_bu_fixed_paths! !_rv!" /v:no /m normal /a
System error 1060 has occurred.
The specified service does not exist as an installed service.
System error 1060 has occurred.
The specified service does not exist as an installed service.
Error: NTBackup failed to create "v:\MJD6_full_05-08-25_10-55-11.bkf"
C:\>
Any thoughts about what might be causing this error?
Which version of Windows are you running?
The script was designed to be used with Windows XP.
Try this, open a command prompt window, and type:
If these reported errors, then your version of windows does not have these services. Does ntbackup still work for you, as I believe these services need to be running for ntbackup to operate correctly.
-Ross
Running Windows 2K sp4
I am running Windows 2K sp4. My errors make sense now that I see which services need to be running.
Thanks
-KM