Questions tagged [zip]
ZIP is a format for compressed file archives, allowing packaging of multiple files and directories into a single file.
            11,104
            questions
        
        
            1267
            votes
        
        
            3
            answers
        
        
            474k
            views
        
    How are zlib, gzip and zip related? What do they have in common and how are they different?
                The compression algorithm used in zlib is essentially the same as that in gzip and zip. What are gzip and zip? How are they different and how are they same?
            
        
       
    
            882
            votes
        
        
            30
            answers
        
        
            781k
            views
        
    How to create a zip archive of a directory?
                How can I create a zip archive of a directory structure in Python?
            
        
       
    
            869
            votes
        
        
            9
            answers
        
        
            1.3m
            views
        
    Unzipping files in Python
                I read through the zipfile documentation, but couldn't understand how to unzip a file, only how to zip a file. How do I unzip all the contents of a zip file into the same directory?
            
        
       
    
            330
            votes
        
        
            8
            answers
        
        
            245k
            views
        
    Create zip file and ignore directory structure
                I need to create a zip file using this command:
zip /dir/to/file/newZip /data/to/zip/data.txt
This works, but the created zip file creates a directory structure mimicking the directory to the raw ...
            
        
       
    
            326
            votes
        
        
            18
            answers
        
        
            838k
            views
        
    How can you zip or unzip from the script using ONLY Windows' built-in capabilities?
                In Windows you can zip some files by 
  right click → Send to → Compressed (zipped) folder
And unzip by double clicking on the .zip file and extract the files.
Is there a way to apply ...
            
        
       
    
            300
            votes
        
        
            24
            answers
        
        
            404k
            views
        
    How to create a zip archive with PowerShell?
                Is it possible to create a zip archive using PowerShell?
            
        
       
    
            283
            votes
        
        
            9
            answers
        
        
            264k
            views
        
    What is a good Java library to zip/unzip files? [closed]
                I looked at the default Zip library that comes with the JDK and the Apache compression libs and I am unhappy with them for 3 reasons:
They are bloated and have bad API design. I have to write 50 ...
            
        
       
    
            282
            votes
        
        
            8
            answers
        
        
            266k
            views
        
    BitBucket - download source as ZIP
                I know I can get the project through git clone command, but is there any way, how to download the project through the web interface from BitBucket.org?
In the best way, I am looking for a way to ...
            
        
       
    
            276
            votes
        
        
            8
            answers
        
        
            133k
            views
        
    Is there a zip-like function that pads to longest length?
                Is there a built-in function that works like zip() but that will pad the results so that the length of the resultant list is the length of the longest input rather than the shortest input?
>>&...
            
        
       
    
            274
            votes
        
        
            1
            answer
        
        
            149k
            views
        
    What is the difference between tar and zip? [closed]
                What is the difference between tar and zip?  What are the use cases for each?
            
        
       
    
            253
            votes
        
        
            16
            answers
        
        
            190k
            views
        
    Mac zip compress without __MACOSX folder?
                When I compress files with the built in zip compressor in Mac OSX, it causes an extra folder titled "__MACOSX" to be created in the extracted zip.
Can I adjust my settings to keep this ...
            
        
       
    
            253
            votes
        
        
            12
            answers
        
        
            303k
            views
        
    Creating a ZIP archive in memory using System.IO.Compression
                I'm trying to create a ZIP archive with a simple demo text file using a MemoryStream as follows:
using (var memoryStream = new MemoryStream())
using (var archive = new ZipArchive(memoryStream , ...
            
        
       
    
            246
            votes
        
        
            31
            answers
        
        
            488k
            views
        
    Fatal error: Class 'ZipArchive' not found in
                I have a problem when I install 'Archive_Zip 0.1.1' on the Linux server, but when I try to run the script to create the zip file it gives the fatal error
Fatal error: Class ZipArchive not found in ......
            
        
       
    
            202
            votes
        
        
            8
            answers
        
        
            231k
            views
        
    How do I ZIP a file in C#, using no 3rd-party APIs?
                I'm pretty sure this is not a duplicate so bear with me for just a minute.
How can I programatically (C#) ZIP a file (in Windows) without using any third party libraries? I need a native windows call ...
            
        
       
    
            188
            votes
        
        
            6
            answers
        
        
            329k
            views
        
    .rar, .zip files MIME Type
                I'm developing a simple php upload script, and users can upload only ZIP and RAR files.
What MIME types I should use to check $_FILES[x][type]? (a complete list please)
            
        
       
    
            184
            votes
        
        
            9
            answers
        
        
            769k
            views
        
    How to unzip a file using the command line? [closed]
                Which commands can be used via the command line to unzip a file?
Preferably something built into Windows or open source/free tools.
            
        
       
    
            183
            votes
        
        
            11
            answers
        
        
            200k
            views
        
    How to create full compressed tar file using Python?
                How can I create a .tar.gz file with compression in Python?
            
        
       
    
            180
            votes
        
        
            6
            answers
        
        
            252k
            views
        
    Read a zipped file as a pandas DataFrame
                I'm trying to unzip a csv file and pass it into pandas so I can work on the file.
The code I have tried so far is: 
import requests, zipfile, StringIO
r = requests.get('http://data.octo.dc.gov/feeds/...
            
        
       
    
            179
            votes
        
        
            20
            answers
        
        
            310k
            views
        
    How to zip a whole folder using PHP
                I have found here at stackoveflow some code on how to ZIP a specific file, but how about a specific folder?
Folder/
  index.html
  picture.jpg
  important.txt
inside in My Folder, there are files. ...
            
        
       
    
            178
            votes
        
        
            17
            answers
        
        
            334k
            views
        
    How to create a zip file in Java
                I have a dynamic text file that picks content from a database according to the user's query. I have to write this content into a text file and zip it in a folder in a servlet. How should I do this?
            
        
       
    
            172
            votes
        
        
            15
            answers
        
        
            220k
            views
        
    Need to ZIP an entire directory using Node.js
                I need to zip an entire directory using Node.js. I'm currently using node-zip and each time the process runs it generates an invalid ZIP file (as you can see from this Github issue).
Is there another,...
            
        
       
    
            171
            votes
        
        
            9
            answers
        
        
            246k
            views
        
    How to use Python's pip to download and keep the zipped files for a package?
                If I want to use the pip command to download a package (and its dependencies), but keep all of the zipped files that get downloaded (say, django-socialregistration.tar.gz) - is there a way to do that?
...
            
        
       
    
            159
            votes
        
        
            10
            answers
        
        
            161k
            views
        
    Using R to download zipped data file, extract, and import data
                @EZGraphs on Twitter writes:
"Lots of online csvs are zipped. Is there a way to download, unzip the archive, and load the data to a data.frame using R? #Rstats"
I was also trying to do this today, ...
            
        
       
    
            156
            votes
        
        
            9
            answers
        
        
            238k
            views
        
    Download Returned Zip file from URL
                If I have a URL that, when submitted in a web browser, pops up a dialog box to save a zip file, how would I go about catching and downloading this zip file in Python?
            
        
       
    
            150
            votes
        
        
            15
            answers
        
        
            175k
            views
        
    How does one make a Zip bomb?
                This question about zip bombs naturally led me to the Wikipedia page on the topic. The article mentions an example of a 45.1 kb zip file that decompresses to 1.3 exabytes.
What are the principles/...
            
        
       
    
            143
            votes
        
        
            4
            answers
        
        
            240k
            views
        
    Python: Open file in zip without temporarily extracting it
                How can I open files in a zip archive without extracting them first?
I'm using pygame. To save disk space, I have all the images zipped up.
Is it possible to load a given image directly from the zip ...
            
        
       
    
            136
            votes
        
        
            7
            answers
        
        
            145k
            views
        
    Zip with list output instead of tuple
                What is the fastest and most elegant way of doing list of lists from two lists?
I have
In [1]: a=[1,2,3,4,5,6]
In [2]: b=[7,8,9,10,11,12]
In [3]: zip(a,b)
Out[3]: [(1, 7), (2, 8), (3, 9), (4, 10), ...
            
        
       
    
            133
            votes
        
        
            4
            answers
        
        
            190k
            views
        
    Download multiple files as a zip-file using php
                How can I download multiple files as a zip-file using php?
            
        
       
    
            130
            votes
        
        
            4
            answers
        
        
            70k
            views
        
    How do I export my project as a .zip of git repository?
                I was recently asked to export as a .zip file one of my projects on my Git repository.
I have actually never had to do this in the 4 years I have been using Git.
I would prefer an answer that is all ...
            
        
       
    
            127
            votes
        
        
            6
            answers
        
        
            113k
            views
        
    How to download/checkout a project from Google Code in Windows?
                How do I download a ZIP file of an entire project from Google Code when there are no prepared downloads available? 
This is what I see on the checkout page:
  Command-line access
  Use this command ...
            
        
       
    
            126
            votes
        
        
            10
            answers
        
        
            154k
            views
        
    I didn't find "ZipFile" class in the "System.IO.Compression" namespace
                I can't use "Zipfile" class in the name space "System.IO.Compression" my code is :
using System;
using System.IO;
using System.IO.Compression;
namespace ConsoleApplication
{
    class Program
    {
 ...
            
        
       
    
            125
            votes
        
        
            12
            answers
        
        
            118k
            views
        
    How to [recursively] Zip a directory in PHP? [duplicate]
                Directory is something like:
home/
    file1.html
    file2.html
Another_Dir/
    file8.html
    Sub_Dir/
        file19.html
I am using the same PHP Zip class used in PHPMyAdmin http://trac....
            
        
       
    
            125
            votes
        
        
            10
            answers
        
        
            162k
            views
        
    How to update one file in a zip archive
                Is it possible to replace a file in a zip file without unzipping?
The file to update is an XML file that resides in a huge zip archive. To update this XML file, I have to unzip the archive, delete the ...
            
        
       
    
            124
            votes
        
        
            9
            answers
        
        
            125k
            views
        
    Python in-memory zip library
                Is there a Python library that allows manipulation of zip archives in memory, without having to use actual disk files? 
The ZipFile library does not allow you to update the archive. The only way ...
            
        
       
    
            124
            votes
        
        
            10
            answers
        
        
            91k
            views
        
    Pairs from single list [duplicate]
                Often enough, I've found the need to process a list by pairs. I was wondering which would be the pythonic and efficient way to do it, and found this on Google:
pairs = zip(t[::2], t[1::2])
I thought ...
            
        
       
    
            122
            votes
        
        
            13
            answers
        
        
            221k
            views
        
    Simplest way to download and unzip files in Node.js cross-platform?
                Just looking for a simple solution to downloading and unzipping .zip or .tar.gz files in Node.js on any operating system.
Not sure if this is built in or I have to use a separate library.  Any ideas? ...
            
        
       
    
            121
            votes
        
        
            7
            answers
        
        
            186k
            views
        
    How to read data from a zip file without having to unzip the entire file
                Is there anyway in .Net (C#) to extract data from a zip file without decompressing the complete file?
I possibly want to extract data (file) from the start of a zip file if the compression algorithm ...
            
        
       
    
            110
            votes
        
        
            8
            answers
        
        
            133k
            views
        
    Zip including hidden files
                In Linux I can zip all(except hidden files) in current directory by doing:
zip 1.zip *
But how do I include the hidden files?
            
        
       
    
            109
            votes
        
        
            3
            answers
        
        
            141k
            views
        
    get file list of files contained in a zip file
                I have a zip archive: my_zip.zip. Inside it is one txt file, the name of which I do not know. I was taking a look at Python's zipfile module ( http://docs.python.org/library/zipfile.html ), but couldn'...
            
        
       
    
            106
            votes
        
        
            12
            answers
        
        
            44k
            views
        
    Can I zip more than two lists together in Scala?
                Given the following Scala List:
val l = List(List("a1", "b1", "c1"), List("a2", "b2", "c2"), List("a3", "b3", "c3"))
How can I get:
List(("a1", "a2", "a3"), ("b1", "b2", "b3"), ("c1", "c2", "c3"))
...
            
        
       
    
            106
            votes
        
        
            6
            answers
        
        
            77k
            views
        
    How to eliminate absolute path in zip archive if absolute paths for files are provided?
                I have two files in two different directories, one is '/home/test/first/first.pdf', the other is '/home/text/second/second.pdf'. I use following code to compress them:
import zipfile, StringIO
buffer =...
            
        
       
    
            100
            votes
        
        
            4
            answers
        
        
            250k
            views
        
    7-Zip command to create and extract a password-protected ZIP file on Windows? [closed]
                On Mac/Linux to zip/unzip password protected zip files, I use:
Zip:
zip -P password -r encrypted.zip folderIWantToZip
Unzip:
unzip -P password encrypted.zip
What are the equivalent command on ...
            
        
       
    
            98
            votes
        
        
            1
            answer
        
        
            103k
            views
        
    In Linux, zip multiple directories in one named zip file [closed]
                I have the following directories, I want to zip up into the same zip file. Can someone provide the correct syntax?
ie. zipping the following directories:
/home/users/jlefler/files 
/opt/software/...
            
        
       
    
            95
            votes
        
        
            1
            answer
        
        
            225k
            views
        
    Install php-zip on php 5.6 on Ubuntu [duplicate]
                I can't install php-zip on my Ubuntu VM with the last php5.6.
Can't find find anything clear on it.
I still get that Apache error : 
PHP Fatal error:  Class 'ZipArchive' not found in /var/www/uta/...
            
        
       
    
            95
            votes
        
        
            8
            answers
        
        
            32k
            views
        
    Can Git treat ZIP files as directories and files inside the ZIP as blobs?
                The scenario
Imagine I am forced to work with some of my files always stored inside .zip files. Some of the files inside the ZIP file are small text files and change often, while others are larger but ...
            
        
       
    
            94
            votes
        
        
            6
            answers
        
        
            231k
            views
        
    Read Content from Files which are inside Zip file
                I am trying to create a simple java program which reads and extracts the content from the file(s) inside zip file. Zip file contains 3 files (txt, pdf, docx). I need to read the contents of all these ...
            
        
       
    
            91
            votes
        
        
            7
            answers
        
        
            165k
            views
        
    Unzipping files
                I want to display OpenOffice files, .odt and .odp at client side using a web browser. 
These files are zipped files. Using Ajax, I can get these files from server but these are zipped files. I have ...
            
        
       
    
            91
            votes
        
        
            12
            answers
        
        
            379k
            views
        
    java.util.zip.ZipException: error in opening zip file
                I have a Jar file, which contains other nested Jars. When I invoke the new JarFile() constructor on this file, I get an exception which says:
  java.util.zip.ZipException: error in opening zip file
...
            
        
       
    
            90
            votes
        
        
            3
            answers
        
        
            82k
            views
        
    Extracting a zipfile to memory?
                How do I extract a zip to memory?
My attempt (returning None on .getvalue()):
from zipfile import ZipFile
from StringIO import StringIO
def extract_zip(input_zip):
    return StringIO(ZipFile(...
            
        
       
    
            89
            votes
        
        
            11
            answers
        
        
            128k
            views
        
    How can I list the files in a zip archive without decompressing it?
                How can I get the equivalent of an ls of a .zip file (not gzip), without decompressing it, from the command shell? That is, how can I list the different files compressed within my .zip archive?