Questions tagged [zip]

ZIP is a format for compressed file archives, allowing packaging of multiple files and directories into a single file.

The specification for the standard is provided by PKWARE, a commercial company that sells compression software. There are multiple independent implementations of ZIP readers and writers, both libraries and finished programs, available on multiple platforms.

Implementations

There are implementations for handling files in ZIP format for many languages:

11022 questions
123
votes
10 answers

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 old XML file, add the new one and then rezip.…
user577732
  • 3,956
  • 11
  • 55
  • 76
122
votes
10 answers

Pairs from single list

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 that was pythonic enough, but after a recent…
Apalala
  • 9,017
  • 3
  • 30
  • 48
121
votes
8 answers

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 seems to be to extract it to a directory, make your…
John B
  • 3,391
  • 5
  • 33
  • 29
118
votes
7 answers

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 compress the file used was in a deterministic…
AwkwardCoder
  • 24,893
  • 27
  • 82
  • 152
116
votes
13 answers

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? Looking for just a couple lines of code so when…
Lance
  • 75,200
  • 93
  • 289
  • 503
109
votes
3 answers

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 done inside command line terminal.
Daniel
  • 14,004
  • 16
  • 96
  • 156
109
votes
8 answers

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?
john-jones
  • 7,490
  • 18
  • 53
  • 86
105
votes
12 answers

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")) Since zip can only be used to combine two Lists, I…
pr1001
  • 21,727
  • 17
  • 79
  • 125
103
votes
3 answers

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't make too much sense of what I'm trying to…
David542
  • 104,438
  • 178
  • 489
  • 842
103
votes
6 answers

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 = StringIO.StringIO() first_path =…
Shang Wang
  • 24,909
  • 20
  • 73
  • 94
98
votes
1 answer

In Linux, zip multiple directories in one named zip file

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/reports/files into a zip file called backup.zip.
user3299633
  • 2,971
  • 3
  • 24
  • 38
96
votes
4 answers

7-Zip command to create and extract a password-protected ZIP file on Windows?

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 Windows on the command line (assuming that 7zip has…
user3254893
  • 1,071
  • 2
  • 13
  • 14
95
votes
1 answer

Install php-zip on php 5.6 on Ubuntu

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/system/library/PHPExcel/PHPExcel/Writer/... Thanks
SoCkEt7
  • 2,237
  • 5
  • 22
  • 30
93
votes
8 answers

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 luckily rather static (e.g. images). If I want…
Jonas Heidelberg
  • 4,984
  • 1
  • 27
  • 41
93
votes
6 answers

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 files and I am using Apache Tika for this…
S Jagdeesh
  • 1,523
  • 2
  • 28
  • 47