Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

gzip

Status
Not open for further replies.

cginewbie

Programmer
Jan 20, 2002
24
US
can any one shows me a good way to compress mutiple files into a Zip file?

i want to compress
folder1 (everything in this folder)
folder2 (everything in this folder)
folder3 (everything in this folder)
file1
file2
file3

could this be done using gzip?
It is in CGI, to be run from a web browser, not command line...thanks
 
What language is the cgi program written in?
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
I can read the manual fine, but too stupid to write some codes in CGI that is accessible from the web. That's why look for some good programmer who can shows me....

thanks for the tip (but I cannot use it)
 
#to compress current directory
system ('tar -c -z ./ > arch.tar.gz');
 
again, this is not what I look for. I am looking to make a tar ball for many directories and files, whose paths are known, not a single file.

thanks for the help
 
This will make recursive archive with all files and subdirectories in the current catalog.

system ('tar -c -z folder1 folder2 folder3 file1 file2 > recursiveArchive.tar.gz');

man tar

 
You can also 'feed' tar a list of file by using the -I switch....

If these lines were in a file named files_to_tar.txt

/some/path/to/a/file.txt
/another/path/to/a/second.txt
/a/third/path/to/a/third.txt


You could then use tar like
Code:
tar -cvf NewTarBall.tar -I files_to_tar.txt

You would end up with a tar ball containing file.txt, second.txt, and third.txt
'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top