Take the 2-minute tour ×

I need to make a zip file available to all my Windows users visitors, so I naively produced a zip file with the Unix zip command (let's call it madeinlinux.zip).

It opens successfully with WinRar or Winzip, but those of my users who are using the standard Windows zip file handling experience failure when trying to unzip it. (Windows XP)

I compressed the same data using Windows built-in zip mecanism, and from a Linux point of view, I cannot see any difference in the file type:

$ file madeinlinux.zip :  Zip archive data, at least v2.0 to extract
$ file madeinwindows.zip : Zip archive data, at least v2.0 to extract

They're must be something specific to a Windows compatible zip file.

Does anyone knows what?

share|improve this question

migrated from stackoverflow.com Jul 16 '09 at 9:38

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

Could you produce one of these ZIP files (with dummy content) and put it on a server for us to download and inspect? –  Bernhard Hofmann Jul 10 '09 at 10:45
This sounds like a case for superuser.com, if it exists yet. –  unwind Jul 10 '09 at 10:45
Sure bernhard, here's the culprit: careerjet.co.uk/devel/Services_Careerjet.zip –  jeje Jul 10 '09 at 10:51
The only windows machine I had to test was a Windows 7 one, and that had no problems opening and extracting the file using explorer. –  Andre Miller Jul 10 '09 at 10:55
hail windows 7 ! –  jeje Jul 10 '09 at 11:13
show 1 more comment

7 Answers

7zip is an open source compression tool that works on Linux, FreeBSD, Mac OS X, BeOS, DOS, Amiga and Windows.

I would highly recommend it based on the windows version.

It supports



share|improve this answer
add comment

zip -Z sets the compression option. -Z store is the most trivial one, as it doesn't compress at all. This is useful when you're using zip as an alternative for tar, or when troubleshooting. In this case you should try to see if an uncompressed archive is usable from Windows. If that is usable, you know that you'll have to pick a non-default compression option.

share|improve this answer
awesome, I'd guess it's the compression algorithm that is causing trouble too... –  Daniel Rosenstark Jul 10 '09 at 13:44
add comment

Try with:

zip -9 -y -r -q file.zip folder/
  • -9 Indicates the slowest compression speed (optimal compression, ignores the suffix list)
  • -r Travel the directory structure recursively
  • -q Quiet mode
share|improve this answer
Can you explain what the options mean? –  slhck Nov 10 '11 at 18:20
I updated the comment, sorry for having done it so late, but I'm new... –  Igor Fobia Nov 26 '11 at 19:13
add comment

Only thing that looks relevant is this


but do read "man zip" on your system before going anywhere else...

share|improve this answer
Hi. Thx for the suggestion, but this -k option takes me back in time a bit too much. It transforms all file name in a 8 character/no case version :( –  jeje Jul 10 '09 at 11:41
Yeah, I remember those days. But did it help the file to read by the built-in Zip program on Windows? –  Daniel Rosenstark Jul 10 '09 at 13:43
Don't know. This file name issue stopped me trying –  jeje Jul 10 '09 at 15:55
My guess is that it's the compression, as MSalters says... –  Daniel Rosenstark Jul 10 '09 at 19:20
add comment

Here is a python script that I am using to zip some files. It has been tested on ubuntu and Vista. A zip generated on Ubuntu opens with the Vista zipper.

I think that I had a similar issue in the past and it was because the zip format was not ZIP_DEFLATED. I am not sure. I will check that.

I hope it helps

import zipfile
import glob, os, sys

class ZipArchive:

    def zip_it(self, dirName, files):
        dirNamePrefix = dirName+"/*"
        for filename in glob.glob(dirNamePrefix):
            if os.path.isfile(filename) and (not self.exclude_svn or (filename.find(".svn\\")==-1)):
                print filename
                name = filename[len(self.folder)+1:]
                self.archive.write(filename, name, zipfile.ZIP_DEFLATED)

    def run(self, folder, name, exclude_svn):
        self.exclude_svn = exclude_svn
        self.folder = folder
        self.archive = zipfile.ZipFile(name+".zip", "w")
        os.path.walk(self.folder, ZipArchive.zip_it, self)

if __name__ == "__main__":
    if (len(sys.argv)==1):
        print "usage zipit folder [name] [svn:yes|no]"
        name = sys.argv[1]
        exclude_svn = False

        if (len(sys.argv)>2): name = sys.argv[2]
        if (len(sys.argv)>3): exclude_svn = (sys.argv[3]=="no")

        arch = ZipArchive()
        arch.run(sys.argv[1], name, exclude_svn)
        print "done"

share|improve this answer
the question is, can it be unzipped using Windows zip mechanism? –  Anonymous Jul 10 '09 at 12:07
yes. i've opened it with the Vista zip tool. I hope it works for you too –  luc Jul 10 '09 at 12:25
add comment

Had a similar issue recently with files produced from a perl script. Found that native windows zip (tested Windows 7 only) incorrectly handles paths with a leading slash and displays an empty zipfile. Solution was to strip the leading slash before adding files. Perhaps some versions of the linux zip command store file paths with leading slashes.

share|improve this answer
According to the App. Notes on the pkware site ( pkware.com/support/zip-app-note/archives ): "The name of the file, with optional relative path. The path stored should not contain a drive or device letter, or a leading slash." –  EKW Apr 7 '13 at 4:39
add comment

There is probably a problem in your file transference from Linux to Windows. If you´re using FTP, try setting a binary transfer (bin command in Windows, before the transference of your files from Linux to Windows).

share|improve this answer
add comment

Your Answer

