Thursday, October 18, 2007

Tar and Gzip in one command

Easier way

tar -czvf osp2.tar.gz --exclude=*.png --exclude=*.jpg --exclude=*.pdf --exclude=*.zip --exclude=*.gz --exclude=*.tar osp
here i am creating .gz archive from osp directory. For some I needed multiple exclude for each file extension. Some one can digg into this. Tougher way Example of how to gzip a single file
tar cvf - foofoo.sql | gzip > foofoo.tar.gz
Example of how to gzip an entire directory:
cd a1 tar cvf - . | gzip > ~/backup-020916.tar.gz

0 Comments: