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?

  • 1
    Could you produce one of these ZIP files (with dummy content) and put it on a server for us to download and inspect? Jul 10, 2009 at 10:45
  • This sounds like a case for superuser.com, if it exists yet.
    – unwind
    Jul 10, 2009 at 10:45
  • 1
    Sure bernhard, here's the culprit: careerjet.co.uk/devel/Services_Careerjet.zip
    – jeje
    Jul 10, 2009 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, 2009 at 10:55
  • hail windows 7 !
    – jeje
    Jul 10, 2009 at 11:13

8 Answers 8


Try with:

zip -9 -y -r -q file.zip folder/
  • -9 Indicates the slowest compression speed (optimal compression, ignores the suffix list)
  • -y Store symbolic links as such in the zip archive, instead of compressing and storing the file referred to by the link
  • -r Travel the directory structure recursively
  • -q Quiet mode
  • 2
    Why would this help with XP compatibility? May 27, 2019 at 15:26
  • 1
    Honestly it was so much time ago that I don't remember clearly; but I can imagine that following the symbolic links could lead to problems (that could happen without -r) and -r allows you take all the folder content Jun 26, 2019 at 9:06
  • @Wowfunhappy I can confirm that files zipped in this manner can be extracted with the default zip extractor in Windows XP SP3 (tested within a virtual machine). Feb 9, 2021 at 10:35

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

packing / unpacking: 7z, ZIP, GZIP, BZIP2 and TAR


  • 10
    I recommend not using yet another 3rd party proprietary tool for this unbelievably common utility (zip a file) available now on all platforms. Mar 20, 2017 at 17:55
  • @Rick O'Shea 7zip is anything except proprietary. In fact, 7zip is seen as the rolemodel open source program for a number of reasons. I checked the edit history of this answer and archive.org, nothing about this answer never mentioned a proprietary tool. So what is your remark about?
    – Testerhood
    Jan 13 at 16:48

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.

  • 1
    awesome, I'd guess it's the compression algorithm that is causing trouble too...
    – Daniel Rosenstark
    Jul 10, 2009 at 13:44

Only thing that looks relevant is this

-k - Attempt  to  convert  the  names  and paths to conform to MSDOS, store only the MSDOS attribute (just the user write attribute from UNIX), and mark the entry as made under
MSDOS (even though it was not); for compatibility with PKUNZIP under MSDOS which cannot handle certain names such as those with two dots.

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

  • 1
    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, 2009 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, 2009 at 13:43
  • Don't know. This file name issue stopped me trying
    – jeje
    Jul 10, 2009 at 15:55
  • My guess is that it's the compression, as MSalters says...
    – Daniel Rosenstark
    Jul 10, 2009 at 19:20

In addition to what others suggested, it's important pay Attention to your file and directory names as Windows does not necessarily like Linux file path and names. It sometimes also escapes them differently when zipping. Examples are numerous, but most importantly dot files (. and ..), files with only case differences (name.txt and NAME.txt), absolute file paths (/tmp/file.txt). Some other characters which are allowed in file names on Windows could cause issues when Windows Explorer is used to open files. In my case ':' character was the deal breaker but took a lot of work to find this out.

So before you resume to using using a lot of parameters, I suggest follow a simple procedure:

  1. Locate the folder or file your zipping up.

  2. run: zip -9 -r -k zip-modified-names.zip /path/to/your/folder

  3. pay attention to what the console spits out. In my case ':' in file names were stripped out.
  4. Move the zip file to a windows machine and attempt to open it.

If this works, you may be better off removing the characters that have been stripped off by -k option from your file/directory names try zipping normally. Note some parameters such as -k have side effects. In this case -k contradicts with -q option (for sym links).

Also -k option may render your file names unreadable. In my case my files were named based on creation time (e.g. 10:55:39.pdf) to facilitate easily locating the required record from archives, but -k option turned it to 105539.pdf which is not easily readable by users. I hence changed the names to 10_55_39.pdf which opens on Windows without using -k option but is still readable.

  • 1
    @TD.512 have you noticed that the 6 years old question still doesn't have definite answer? Best to add another answer, if the answer seems to help someone as others didn't.
    – Hi-Angel
    Nov 3, 2015 at 6:36

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.

  • 2
    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, 2013 at 4:39

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"

  • the question is, can it be unzipped using Windows zip mechanism?
    – Anonymous
    Jul 10, 2009 at 12:07
  • yes. i've opened it with the Vista zip tool. I hope it works for you too
    – luc
    Jul 10, 2009 at 12:25

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

  • 2
    Disagree. I've run into similar problems as the OP, particularly with old versions of Windows. I've done integrity checks and the shasum's match up. Plus, note that OP says the files decompress properly in 3rd party programs. May 27, 2019 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy