Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I ve been trying to zip all the files in partcular directory into a single zip file and then transfer it to destination server. command i ve used is like

zip -j $Zipfilename *

the problem is sometimes the total size of all the files is reaching > 2GB so i'm getting below warning

zip warning: name not matched

and files are not getting zipped .Is there is anyother way to do it, without getting the above error? Please help me out!!

share|improve this question

migrated from stackoverflow.com Feb 28 '12 at 12:03

This question came from our site for professional and enthusiast programmers.

    
couldn't you just stay under the 2GB limit, by creating multiple zip files? –  vulkanino Feb 28 '12 at 11:50
    
The warning message does not appear to be related to file size limits at all. Have you tried zip -j $Zipfilename directory/ instead of wildcards? –  grawity Feb 28 '12 at 12:32
    
@grawity Interestingly, I've read that zip can't produce files bigger than 2GB. –  slhck Feb 28 '12 at 12:43
2  
@slhck: The limit of the usual ZIP file format is either 2 GB or 4 GB depending on the program, although Zip64 has been published by PKWare. I'm not sure about the limitations of the zip utility (which I think is InfoZIP). –  grawity Feb 28 '12 at 12:57
    
What OS? The Posix pax utility can emulate tar/cpio and: "The cpio and ustar formats can only support files up to 8589934592 bytes (8 * 2^30) in size." –  glenn jackman Feb 28 '12 at 15:15

3 Answers 3

Zip is not known to be able to create ZIPs greater than 2GB in size. For better or worse, Linux has other tools such as tar, gzip, bzip and others that you can use which have a much higher limit on what they can create. However, if you insist on sticking to ZIP, you could try and use the --split-size directive like so:

zip -j --split-size 2g $zipfilename *

In case you're wondering about the alternatives...

Creating with Tar

tar -cf name_of_zip.tar directory/

This will create a simple Tar(ball) file. Good for on-the-fly and when you need to get something out quick.

tar -czf name_of_zip.tar.gz directory/

This creates a Tar-Gzipped file of a directory. tar-gz is a Tar(ball) that has been further compressed by gzip. It's slightly slower than a standard Tar operation, but provides pretty good compression for what you're getting.

tar -cjf name_of_zip.tar.bz directory/

This creates a Tar-BZipped file of a directory. tar-bz is the slowest tar option you can use, but provides the greatest amount of compression on top of the tar.

Untarring is a simple matter of replacing the -c switch with a -x switch. IE:

tar -xzf /tmp/some_file.tar.gz

Which untars the /tmp/some_file.tar.gz tar(ball) into whatever directory I'm currently in.

Creating with gzip

gzip -c file file2 file3 > newfile.gz`

Creates a new gzip file from a file, or a bunch of files.

gzip -cr directory/ > newfile.gz`

Creates a new gzip from a directory.

Unzipping is a matter of simply using gunzip on your gzip file.

Creating with bzip

BZip doesn't do directory traversal, so it's only good for zipping up one-or-many files.

bzip2 -ck file -<number> > compress.bz

where is a number between 1 and 9, 1 being the lowest level of compression and 9 being the highest.

share|improve this answer

unzip version 6.0 and zip version 3.0 support greater than 2GB files.

New features in UnZip 6.0, released 20 April 2009:

  • Support PKWARE ZIP64 extensions, allowing Zip archives and Zip archive entries larger than 4 GiBytes and more than 65536 entries within a single Zip archive. This support is currently only available for Unix, OpenVMS and Win32/Win64.
  • Support for bzip2 compression method.

New features in Zip 3.0, released 7 July 2008:

  • large-file support (i.e., > 2GB)
  • support for more than 65536 files per archive
  • multi-part archive support
  • bzip2 compression support
share|improve this answer

unix-way is to use tar for multiplexing files together and gzip/bzip2/any-other-compressor to compress .tar archive.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.