extract GZ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
CONFIQ
Forum Commoner
Posts: 32
Joined: Fri Oct 18, 2002 3:39 pm
Location: Israel - Raanana

extract GZ?

Post by CONFIQ »

I need examle how to extract GZ file...
'Till now i've make this

Code: Select all

<?php $file = 'gz.gz'; 
$test = gzopen("$file",'r'); 
$data = gzread($test,1000); 
print_r($data) 

?>
It will echo data as i want to,but what if in *.gz is more that 2 files? how do i extract just one?
User avatar
BigE
Site Admin
Posts: 139
Joined: Fri Apr 19, 2002 9:49 am
Location: Missouri, USA
Contact:

Post by BigE »

Well, the PHP functions are just for gzip, not tar. When you have files in an archive like that, they are most likely tared also. gzip is only compression, it doesn't handle anything with the taring process. I suggest you take a look nin Pear, there is a TAR class in there that could be helpful.
User avatar
daven
Forum Contributor
Posts: 332
Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:

Post by daven »

If the nin Pear class cannot do what you need, it is always possible to run a system command to handle *.tar/*.gz files.
CONFIQ
Forum Commoner
Posts: 32
Joined: Fri Oct 18, 2002 3:39 pm
Location: Israel - Raanana

Post by CONFIQ »

Yeah but i don't need TAR in this case...
I've just wander how to extract GZ if there is more than 2 files or how to list them.But,as i can understand,GZ compression dosen't support more than 2 files.Right?
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

CONFIQ wrote:Yeah but i don't need TAR in this case...
I've just wander how to extract GZ if there is more than 2 files or how to list them.But,as i can understand,GZ compression dosen't support more than 2 files.Right?
That's what BigE tried to say. GZ doesn't combine files like that.
CONFIQ
Forum Commoner
Posts: 32
Joined: Fri Oct 18, 2002 3:39 pm
Location: Israel - Raanana

Post by CONFIQ »

groovy :)
Thank you guys
Post Reply