Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

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

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
synux
Posts: 226
Joined: 2007-02-11 09:09

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

#1 Post by synux »

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!

Grifter
Posts: 1554
Joined: 2006-05-04 07:53
Location: Svea Rike

#2 Post by Grifter »

Eagles may soar, but weasels don't get sucked into jet engines...

synux
Posts: 226
Joined: 2007-02-11 09:09

#3 Post by synux »

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!

Grifter
Posts: 1554
Joined: 2006-05-04 07:53
Location: Svea Rike

#4 Post by Grifter »

so do it

mkdir $dirname; cd $dirname; unzip ../$zipfile; cd ..; done
Eagles may soar, but weasels don't get sucked into jet engines...

Harold
Posts: 1482
Joined: 2005-01-07 00:15
Been thanked: 3 times

#5 Post by Harold »

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

synux
Posts: 226
Joined: 2007-02-11 09:09

#6 Post by synux »

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!

Grifter
Posts: 1554
Joined: 2006-05-04 07:53
Location: Svea Rike

#7 Post by Grifter »

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...

synux
Posts: 226
Joined: 2007-02-11 09:09

#8 Post by synux »

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!

Grifter
Posts: 1554
Joined: 2006-05-04 07:53
Location: Svea Rike

#9 Post by Grifter »

I guess I clarified it for you (:
Eagles may soar, but weasels don't get sucked into jet engines...

Harold
Posts: 1482
Joined: 2005-01-07 00:15
Been thanked: 3 times

#10 Post by Harold »

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

Grifter
Posts: 1554
Joined: 2006-05-04 07:53
Location: Svea Rike

#11 Post by Grifter »

learn something new every day
Eagles may soar, but weasels don't get sucked into jet engines...

synux
Posts: 226
Joined: 2007-02-11 09:09

#12 Post by synux »

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!

Harold
Posts: 1482
Joined: 2005-01-07 00:15
Been thanked: 3 times

#13 Post by Harold »


synux
Posts: 226
Joined: 2007-02-11 09:09

#14 Post by synux »

Thanks! Looks very promising :D
Don't dream your life; live your dream!

User avatar
garrincha
Posts: 2335
Joined: 2006-06-02 16:38

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

#15 Post by garrincha »

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."

synux
Posts: 226
Joined: 2007-02-11 09:09

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

#16 Post by synux »

garrincha wrote: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
Cool!
Don't dream your life; live your dream!

Post Reply