Possible to 'unzip' with the same effect like 'gunzip' ??

Need help with C, C++, perl, python, etc?

Possible to 'unzip' with the same effect like 'gunzip' ??

Postby synux » 2007-02-13 18:17

Hello!

I like the functionality of GZip and I would like to UnZip some Zips (well, actually hundreds) with the same effect as GZip.. you might ask "what effect?".. Look:

If we create a file, let's say debian-test: touch debian-test
Then we GZip it: gzip debian-test
It will make a debian-test.gz file of the original file, but the original file is gone.
So let's GunZip it: gunzip debian-test.gz
It will give us back the debian-test file, but the archive is gone. This is what I like.

But in Zip/UnZip, you need to specify a path where the archive should be made/extracted and it will leave the original files which is absolutely annyoing.. Oh and please note that I have a directory where is a subdirectory with many Zips and again lots of subdirectories with many Zips... So this makes stuff a little bit complicated..

Thanks to anyone who would be so kind to help me to UnZip the Zip files!
Don't dream your life; live your dream!
synux
 
Posts: 232
Joined: 2007-02-11 09:09

Postby Grifter » 2007-02-13 18:26

Eagles may soar, but weasels don't get sucked into jet engines...
Grifter
 
Posts: 1572
Joined: 2006-05-04 07:53
Location: Svea Rike

Postby synux » 2007-02-13 18:28

Grifter wrote:http://forums.debian.net/viewtopic.php?t=11720

No no no.. that's different. I already saw that post before posting this. To make that Bash script to work for me, I need to add the command cd to UnZip the Zips in their appropriate subdirectories..
Don't dream your life; live your dream!
synux
 
Posts: 232
Joined: 2007-02-11 09:09

Postby Grifter » 2007-02-13 18:33

so do it

mkdir $dirname; cd $dirname; unzip ../$zipfile; cd ..; done
Eagles may soar, but weasels don't get sucked into jet engines...
Grifter
 
Posts: 1572
Joined: 2006-05-04 07:53
Location: Svea Rike

Postby Harold » 2007-02-13 18:48

Are you saying that gunzip will not uncompress any of these files?
Harold
 
Posts: 1502
Joined: 2005-01-07 00:15

Postby synux » 2007-02-13 18:54

Harold wrote:Are you saying that gunzip will not uncompress any of these files?

$ gunzip roland_grand_piano.zip
gunzip: roland_grand_piano.zip: unknown suffix -- ignored
Don't dream your life; live your dream!
synux
 
Posts: 232
Joined: 2007-02-11 09:09

Postby Grifter » 2007-02-13 18:56

gunzip doesn't work on zip files because gzip just compresses, whereas a zip file is an archive like tar, which just happens to be compressed
Eagles may soar, but weasels don't get sucked into jet engines...
Grifter
 
Posts: 1572
Joined: 2006-05-04 07:53
Location: Svea Rike

Postby synux » 2007-02-13 18:58

Grifter wrote:gunzip doesn't work on zip files because gzip just compresses, whereas a zip file is an archive like tar, which just happens to be compressed

That's what I'm trying to clarify..
Don't dream your life; live your dream!
synux
 
Posts: 232
Joined: 2007-02-11 09:09

Postby Grifter » 2007-02-13 18:59

I guess I clarified it for you (:
Eagles may soar, but weasels don't get sucked into jet engines...
Grifter
 
Posts: 1572
Joined: 2006-05-04 07:53
Location: Svea Rike

Postby Harold » 2007-02-13 19:01

Files created by zip can be uncompressed by gzip only if they have a single member compressed with the 'deflation' method. This feature is only intended to help conversion of tar.zip files to the tar.gz format. To extract zip files with several members, use unzip instead of gunzip.

http://tinyurl.com/2v7yt2
Harold
 
Posts: 1502
Joined: 2005-01-07 00:15

Postby Grifter » 2007-02-13 19:02

learn something new every day
Eagles may soar, but weasels don't get sucked into jet engines...
Grifter
 
Posts: 1572
Joined: 2006-05-04 07:53
Location: Svea Rike

Postby synux » 2007-02-13 19:10

Harold wrote:Files created by zip can be uncompressed by gzip only if they have a single member compressed with the 'deflation' method. This feature is only intended to help conversion of tar.zip files to the tar.gz format. To extract zip files with several members, use unzip instead of gunzip.

http://tinyurl.com/2v7yt2

My Zip files have several members :(
Don't dream your life; live your dream!
synux
 
Posts: 232
Joined: 2007-02-11 09:09

Postby Harold » 2007-02-13 19:12

Harold
 
Posts: 1502
Joined: 2005-01-07 00:15

Postby synux » 2007-02-13 19:58


Thanks! Looks very promising :D
Don't dream your life; live your dream!
synux
 
Posts: 232
Joined: 2007-02-11 09:09

Re: Possible to 'unzip' with the same effect like 'gunzip' ?

Postby garrincha » 2007-02-14 14:34

I don't know if it's relevant for you, however I use a debian package called 'unp' which unpack almost everything including *.tar.gz, *.tar.bz, *.rpm, *.deb, *.zip, *.rar with one command. Of course you need to install some non-free packages like 'unrar' for *.rar file for example. Unp can be installed by apt-get:

http://packages.debian.org/unstable/utils/unp
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."
User avatar
garrincha
 
Posts: 2340
Joined: 2006-06-02 16:38

Next

Return to Programming

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable