Keith Kim’s Blog
Technology, Development, Tech Trends, Tech Team Management
2nd
SEP
Back up using DOS batch
Posted by Keith under Tips
Almost always I make backups of important files, but I still lose up-to-date files. So automating/scheduling backup is needed.
I do:
- Files are backed up continously using Mozy.
- Image of C drive is created daily onto another HDD.
- Some important files are backed up using SyncBack to another computer.
- For MySQL, I use MySQL Administrator to schedule back up.
Fo sync back, it is easier if a directory is ZIPed up. So here is a simple batch file:
[sourcecode language=’css’]
@echo off
REM =============
REM back up daily
REM Run by WinXP scheduler
REM =============
REM === Get current date
FOR /F “TOKENS=1* DELIMS= ” %%A IN (’DATE/T’) DO SET CDATE=%%B
FOR /F “TOKENS=1,2 eol=/ DELIMS=/ ” %%A IN (’DATE/T’) DO SET mm=%%B
FOR /F “TOKENS=1,2 DELIMS=/ eol=/” %%A IN (’echo %CDATE%’) DO SET dd=%%B
FOR /F “TOKENS=2,3 DELIMS=/ ” %%A IN (’echo %CDATE%’) DO SET yyyy=%%B
SET date=%yyyy%%mm%%dd%
REM KK-20080829: backing up Palm
zip -r “C:\BACKUP\palm\kkim_%date%.zip” “C:\Program Files\palmOne\kkim”
[/sourcecode]
I got this “date” batch script from the net. Sorry, don’t remember where I got it. This works very well, and kudos to who wrote it.
I have cygwin installed and c:\cygwin\bin is in my PATH, thus the ‘zip’ executable is used in the batch file. And Windows scheduler is used here. And, SyncBack will pick up the file and put it onto another computer. Or, the ZIP file can be created on another HDD.
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Jan | ||||||
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 | 31 | ||||
Recent Posts
- Google Go, windows version is out
- Using Clojure in Cygwin
- Editing big text files in Windows
- Try Google Chrome OS
- The surprising science of motivation: Dan Pink on TED.com
Recent Comments
- Keith on Code Review tools
- Jesse Gibbs on Code Review tools
- pdumsproject on MS Project replacement (Desktop apps)
- sparky on EverNote, better than Microsoft OneNote
- Keith on Intro: Java ME and Palm
Categories
- Architecture
- Books
- Clojure
- Cool Apps
- Development Tools
- Erlang
- Fun
- Golang
- J2EE
- J2ME
- Java
- Lisp
- Management
- PDA
- Sites
- Tips
- Unix/Linux
- Windows
Archives
- January 2010
- December 2009
- November 2009
- July 2009
- May 2009
- January 2009
- December 2008
- November 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- April 2007