Questions tagged [zip]

For questions about ZIP files and associated tools. ZIP is a file format used for data compression and archiving.

ZIP files are archive files, containing other files which can optionally be compressed and/or encrypted. The ZIP format is very popular, dating back to PKZIP in 1989, supported by tools available on most if not all platforms. It is also used as the format for a number of other file types, including JAR files (as used in the Java world) and OpenDocument files (as used by LibreOffice and OpenOffice).

On Unix and Linux platforms, ZIP files are handled by Info-ZIP and many other tools, including file managers such as Midnight Commander and Nautilus (GNOME Files). The format is supported by a number of libraries, including libzip.

548 questions
731
votes
5 answers

Zip all files in directory?

Is there a way to zip all files in a given directory with the zip command? I've heard of using *.*, but I want it to work for extensionless files, too.
tkbx
  • 10,597
  • 13
  • 35
  • 41
673
votes
9 answers

How do I zip/unzip on the unix command line?

How can I create and extract zip archives from the command line?
joachim
  • 7,617
  • 4
  • 17
  • 8
542
votes
7 answers

Can I zip an entire folder using gzip?

I'm trying to zip a folder in unix. Can that be done using the gzip command?
user1269502
  • 5,521
  • 4
  • 13
  • 4
273
votes
8 answers

Extract only a specific file from a zipped archive to a given directory

I need to extract a single file from a ZIP file which I know the path to. Is there a command like the following: unzip -d . myarchive.zip path/to/zipped/file.txt Unfortunately, the above command extracts and recreates the entire path to the file at…
Naftuli Kay
  • 38,686
  • 85
  • 220
  • 311
203
votes
6 answers

Zip the contents of a folder without including the folder itself

I have a directory called folder that looks like this: folder -> root_folder -> some files I want to zip this directory into zipped_dir, I tried: zip -r zipped_dir.zip folder/* But this generates a ZIP that looks like…
Juicy
  • 3,685
  • 11
  • 31
  • 44
169
votes
2 answers

Zip everything in current directory

I'd like to compress and package everything, including files and folders in current directory, into a single ZIP file on Ubuntu. What would be the most convenient command for this (and name of the tool needed to be installed if any)? Edit: What if I…
Terry Li
  • 1,935
  • 2
  • 17
  • 14
134
votes
10 answers

How to unzip a multipart (spanned) ZIP on Linux?

I need to upload a 400mb file to my web server, but I'm limited to 200mb uploads. My host suggested I use a spanned archive, which I've never done on Linux. I created a test in its own folder, zipping up a PDF into test.zip.001, .002, and .003. How…
Tim
  • 1,443
  • 2
  • 10
  • 5
111
votes
6 answers

How to extract only a specific folder from a zipped archive to a given directory?

How does one extract a specific folder from a zipped archive to a given directory? I tried using unzip "/path/to/archive.zip" "in/archive/folder/" -d "/path/to/unzip/to" but that only creates the folder on the path I want it to unzip to and does…
Enkouyami
  • 1,378
  • 2
  • 12
  • 15
83
votes
1 answer

How to list files in a zip without extra information in command line

In my bash command line, when I use unzip -l test.zip I get the output like this: Archive: test.zip Length Date Time Name --------- ---------- ----- ---- 810000 05-07-2014 15:09 file1.txt 810000 05-07-2014 15:09 …
рüффп
  • 1,677
  • 4
  • 27
  • 35
76
votes
6 answers

Unzip file contents, but without creating archive folder

I have a file myarchive.zip that contains many directories, files, etc. Let's say this myarchive.zip file lives in a directory called "b". Well, when I use the "unzip myarchive.zip" command, the system creates a directory by default called…
ScoobaSteve
  • 861
  • 1
  • 6
  • 4
75
votes
2 answers

Command to zip multiple directories into individual zip files

I have a single directory that contains dozens of directories inside of it. I'm new to command line and I'm struggling to come up with a command that will zip each sub-directory into a unique sub-directory.zip file. So in the end my primary…
Evster
  • 1,695
  • 2
  • 13
  • 12
74
votes
5 answers

Adding unzipped files to a zipped folder

I'm trying to add unzipped files to an existing already zipped folder say new folder.zip. Is it possible to use zip -r new folder.zip after adding some unzipped files to them? Will this command compress the folder? Is there any alternative to do…
boo na
  • 741
  • 1
  • 5
  • 3
62
votes
5 answers

Why is the wild card character * so different between the zip and rm commands?

I put together a script to do some file operations for me. I am using the wild card operator * to apply functions to all files of a type, but there is one thing I don't get. I can unzip all files in a folder like this unzip "*".zip However, to…
patrick
  • 1,002
  • 1
  • 10
  • 16
60
votes
7 answers

When I use zip, how can I display the overall progress without flooding the command line?

A fixed-length progress bar, a file or byte count, or better yet a timer showing the estimated time remaining would be ideal. zip's standard behavior seems to be to print a line for every file processed, but I don't want that information overload…
bug
  • 2,418
  • 6
  • 22
  • 23
56
votes
7 answers

Extra-bytes error when unzipping a file

When I enter unzip ../founation-latest.zip, it outputs this: warning [../foundation-latest.zip]: 248 extra bytes at beginning or within zipfile (attempting to process anyway) The file is 138KB. It unzips correctly, but why am I getting this…
rainwater11
  • 693
  • 1
  • 5
  • 6
1
2 3
36 37