How to create a zip file compatible with windows under linux - Super User most recent 30 from superuser.com 2010-03-21T14:09:10Z http://superuser.com/feeds/question/5155 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://superuser.com/questions/5155/how-to-create-a-zip-file-compatible-with-windows-under-linux 3 How to create a zip file compatible with windows under linux jeteve http://superuser.com/users/3213 2009-07-10T10:40:00Z 2009-07-16T09:43:34Z <p>Hi all,</p> <p>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).</p> <p>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. (Win XP)</p> <p>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:</p> <pre><code>$ file madeinlinux.zip : Zip archive data, at least v2.0 to extract $ file madeinwindows.zip : Zip archive data, at least v2.0 to extract </code></pre> <p>They're must be something specific to a windows compatible zip file.</p> <p>Does anyone knows what?</p> <p>Cheers !!!</p> <p>J.</p> http://superuser.com/questions/5155/how-to-create-a-zip-file-compatible-with-windows-under-linux/5156#5156 -1 Answer by ghostdog74 for How to create a zip file compatible with windows under linux ghostdog74 http://superuser.com/users/17045 2009-07-10T11:00:41Z 2009-07-16T09:38:24Z <p>@OP, did you try gzip instead?</p> http://superuser.com/questions/5155/how-to-create-a-zip-file-compatible-with-windows-under-linux/5157#5157 -1 Answer by gromgull for How to create a zip file compatible with windows under linux gromgull http://superuser.com/users/0 2009-07-10T11:10:39Z 2009-07-16T09:38:24Z <p>@ghostdog74: gzip does definitely NOT open on windows, especially as it compresses only a single file, and is usually combined with tar when doing multiple files. </p> http://superuser.com/questions/5155/how-to-create-a-zip-file-compatible-with-windows-under-linux/5158#5158 1 Answer by Yar for How to create a zip file compatible with windows under linux Yar http://superuser.com/users/4952 2009-07-10T11:15:08Z 2009-07-16T09:38:24Z <p>Only thing that looks relevant is this</p> <pre><code>-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. </code></pre> <p>but do read "man zip" on your system before going anywhere else...</p> http://superuser.com/questions/5155/how-to-create-a-zip-file-compatible-with-windows-under-linux/5159#5159 0 Answer by user17710 for How to create a zip file compatible with windows under linux user17710 http://superuser.com/users/17710 2009-07-10T12:03:01Z 2009-07-16T09:38:24Z <p>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.</p> <p>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.</p> <p>I hope it helps</p> <pre> 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) self.archive.close() if __name__ == "__main__": if (len(sys.argv)==1): print "usage zipit folder [name] [svn:yes|no]" else: 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" </pre> http://superuser.com/questions/5155/how-to-create-a-zip-file-compatible-with-windows-under-linux/5160#5160 1 Answer by MSalters for How to create a zip file compatible with windows under linux MSalters http://superuser.com/users/0 2009-07-10T13:29:01Z 2009-07-16T09:38:24Z <p><code>zip -Z</code> sets the compression option. <code>-Z store</code> is the most trivial one, as it doesn't compress at all. This is useful when you're using <code>zip</code> as an alternative for <code>tar</code>, or when troubleshooting. In this case you should try to see if an uncompressed archive is usable from Windows. If that <em>is</em> usable, you know that you'll have to pick a non-default compression option.</p> http://superuser.com/questions/5155/how-to-create-a-zip-file-compatible-with-windows-under-linux/5164#5164 0 Answer by Bruce McLeod for How to create a zip file compatible with windows under linux Bruce McLeod http://superuser.com/users/372 2009-07-16T09:43:34Z 2009-07-16T09:43:34Z <p><a href="http://www.7-zip.org/" rel="nofollow">7zip</a> is an open source compression tool that works on Linux, FreeBSD, Mac OS X, BeOS, DOS, Amiga and Windows.</p> <p>I would highly recommend it based on the windows version.</p> <p>It supports</p> <blockquote> <p>packing / unpacking: 7z, ZIP, GZIP, BZIP2 and TAR</p> <p>Unpacking only: ARJ, CAB, CHM, CPIO, DEB, DMG, HFS, ISO, LZH, LZMA, MSI, NSIS, RAR, RPM, UDF, WIM, XAR and Z.</p> </blockquote>