Backing up data on a Windows machine using TAR and GZIP
Creating a Full Backup
You can create a simple batch file which calls both the tar and gzip programs in turn to create a compressed backup file, which contains all the data files in your specified directory.
Example1.bat
tar -cv –file=backup.tar d:/data*
gzip -9 < backup.tar > backup.tar.tgz
del backup.tar
Backing up More Than One Directory
You can set-up the batch file to backup multiple directory / folder tree structures. Example2.bat shown below demonstrates how this is achieved. You create the initial backup.tar file for your first directory using the -cv command. Then for every other directory structure, you use the -rv command to append the new directory / folder to the backup.tar file.
Example2.bat
tar -cv –file=backup.tar d:/data*
tar -rv –file=backup.tar d:/websites*
gzip -9 < backup.tar > backup.tar.tgz
del backup.tar
Creating an Incremental Backup
Creating an incremental backup is very easy, you just need to specify a date to the –newer command. Tar will then only include files which have changed since that date. The Example3.bat batch file shown below demonstrates creating an incremental backup for all files in the d:/data directory which have been modified since the 1st of September 2004.
Example3.bat
tar -cv –newer=2004-09-01 –file=incremental.tar d:/data*
gzip -9 < incremental.tar > incremental.tar.tgz
del incremental.tar
Download, References
http://downloads.cgi-interactive.net/tar-gzip.zip
http://www.gnu.org/software/tar/manual/index.html
http://www.gnu.org/software/gzip/manual/gzip.html
'유용한 정보' 카테고리의 다른 글
Tistory에서 소스코드 하이라이트 기능 사용하기 (SyntaxHighlighter) (0) | 2010.06.24 |
---|---|
노트북 동작 클럭이 반으로 설정되어 있을 때 해결 (0) | 2010.05.31 |
[노하우] 취직보다 중요한 퇴직의 십계명! (0) | 2010.03.30 |
고승덕 변호사 공부 비법 (1) | 2010.02.24 |
좋은글 (0) | 2009.10.27 |