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

Monday, October 15, 2007

How to Escape the SAX parser from wild characters

SAX parser give you a exception if your string contain a & parameter. This character is normal on a URL when parsing URL's this could be headache work around is . convert & with & amp ; all without space

Tuesday, October 2, 2007

Listing your drives

File []file=File.listRoots(); for (File fl : file){ System.out.println(fl.getPath()); }