uncompressed file in zip archive

The place to post if you need help or advice

Moderators: ChrisThornett, LXF moderators

uncompressed file in zip archive

Postby guy » Tue Oct 15, 2013 3:57 pm

I need to put several files in a zip archive, the first has to be uncompressed (this is an ePub format ebook and the first file contains the mime type which utility tools need to be able to read without understanding decompression).

My Debian/Gnome desktop insists on compressing the file, so does gzip which is probably why. Can anybody suggest a zip creator for debian that does allow individual choice of compression?
"Klinger, do you know how many zoots were killed to make that one suit?" — BJ Hunnicutt
User avatar
guy
LXF regular
 
Posts: 1105
Joined: Thu Apr 07, 2005 12:07 pm
Location: Worcestershire

Postby nelz » Tue Oct 15, 2013 4:13 pm

gzip does not create zip files, it gzips single files or data streams. You want zip and use the -Z option to not compress the first file

Code: Select all
zip -Z store archive.zip firstfile
zip archive.zip all the other files


You can also use the --suffixes option to specify the suffixes of files that should not be compressed, but if you need the uncompressed file to be first in the archive, the above example is more reliable.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 8577
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

Postby guy » Tue Oct 15, 2013 6:13 pm

guy@hostname:~/Downloads$ zip -Z store archive.zip mimetype
bash: zip: command not found

hence my attempt to use gzip. I tried looking in the repos but found loads of zip utils, many obviously not what was wanted and no easy way to pick a winner.
"Klinger, do you know how many zoots were killed to make that one suit?" — BJ Hunnicutt
User avatar
guy
LXF regular
 
Posts: 1105
Joined: Thu Apr 07, 2005 12:07 pm
Location: Worcestershire

Postby nelz » Tue Oct 15, 2013 7:16 pm

Which distro? On most the package is simply called zip.

The only thing zip and gzip have in common is the last three letters of their names.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 8577
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

Postby guy » Tue Oct 15, 2013 7:43 pm

debian squeeze
"Klinger, do you know how many zoots were killed to make that one suit?" — BJ Hunnicutt
User avatar
guy
LXF regular
 
Posts: 1105
Joined: Thu Apr 07, 2005 12:07 pm
Location: Worcestershire

Postby guy » Wed Oct 16, 2013 4:06 pm

Ah, found zip. Not installed by default. Oddly, Synaptic's search wouldn't find it even though it's in the repos. I had to scroll to the bottom of the list. It found unzip though.

And yay, it worked! I have a valid ePub file. :D
"Klinger, do you know how many zoots were killed to make that one suit?" — BJ Hunnicutt
User avatar
guy
LXF regular
 
Posts: 1105
Joined: Thu Apr 07, 2005 12:07 pm
Location: Worcestershire


Return to Help!

Who is online

Users browsing this forum: Google [Bot] and 0 guests