Zip is a file format used for data compression and archiving.

learn more… | top users | synonyms (1)

22
votes
6answers
113k views

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

How can I create and extract zip archives from the command line?
15
votes
1answer
17k views

How do you extract a single folder from a large tar.gz archive?

I am using this command on a 5GB archive tar -zxvf archive.tar.gz /folder/in/archive is this the correct way to do this? It seems to be taking forever with no command line output...
13
votes
3answers
22k views

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

I need to pull 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 ...
13
votes
4answers
30k views

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, ...
12
votes
5answers
1k views

How to de-unzip, de-tar -xvf — de-unarchive in a messy folder?

Usually, I unarchive things by $ mkdir newFolder; $ mv *.zip newFolder; $ cd newFolder; $unzip *.zip but sometimes I get lazy and just do in an arbitrary folder $ unzip *.zip so time-to-time messing ...
10
votes
1answer
2k views

The zip format's external file attribute

This is a slightly exotic question, but there doesn't seem to be much information on the net about this. I just added an answer to a question about the zip format's external file attribute. As you can ...
8
votes
1answer
257 views

Do any archive utilities exist that can preserve the date created file attribute on NTFS-3G?

I tried the -X switch on zip, but that did not save the date created attribute. I can get it using this method. When a file is added to a zip archive using 7-Zip, it preserves the date created and ...
7
votes
2answers
586 views

Remove accidentally extracted files [duplicate]

Possible Duplicate: How to de-unzip, de-tar -xvf — de-unarchive in a messy folder? This is a pretty annoying occurrence. Sometimes, I download an archive (tar.gz, tar.bz2, zip, rar, ...
7
votes
4answers
4k views

How can I force unzip / zip not to create a subdirectory when I extract it?

Depending on how a zip file is created, sometimes it will extract all of the files directly, and sometimes it will extract the files into a subdirectory. If the latter is true, how can I force the ...
6
votes
4answers
300 views

How to only zip the files of a specific user?

I like zip, it's simple, but recently I came with the need of only zipping the file owned by one user in a directory. I read the manual and I can't find any option to for example do things like: ...
6
votes
1answer
7k views

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 ...
6
votes
4answers
2k views

Copy a File From One Zip to Another?

I have a file named 'sourceZip.zip' This file ('sourceZip.zip') contains two files: 'textFile.txt' 'binFile.bin' I also have a file named 'targetZip.zip' This file ('targetZip.zip') contains ...
6
votes
2answers
699 views

How can I create a zip file v2.0?

How can I create a zip file v2.0? It seems OpenDocument files are zip files v2.0: $ file foo.odt foo.odt: OpenDocument Text $ hexdump -C -n 16 foo.odt 00000000 50 4b 03 04 14 00 00 08 00 00 03 0d ...
6
votes
3answers
13k views

Searching for a string on multiple zip files.

I have a folder that contains about 200 zip files. Each zip file contains only one text file in it. I would like to search for a specific string in all the text files in all the zip files. I tried ...
6
votes
2answers
4k views

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 ...
6
votes
2answers
765 views

Add a file to a different path in a zip file

I have a file that placed in the following directory: folder_A/another_folder_A/file_to_add.xml Now, what I want to do is simply add the file to a folder in an existing zip archive. For example ...
6
votes
2answers
1k views

Add file to deep inside a zip file

Say I want to add the file file.txt to foo.zip, I could just do zip -u foo.zip file.txt. However inside the zip-file there already exist a folder with the path foo.zip/very/many/paths/ (relatively to ...
6
votes
1answer
503 views

Unzipping certain archives works on Windows but not on Linux

I've asked a few people and just thought about asking it here. We get sent files from an international company for design work in a zip format. Well when I run a script to unzip the files in the ...
5
votes
1answer
7k views

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 ...
5
votes
2answers
143 views

How to zip a file and save it in another directory

How can I zip a file and save it in another directory using the command line? I have no space left in directory (100% full).
5
votes
4answers
3k views

Is it possible in unix to search inside zip files

I have 100s of directories and within those I have a few zip files. Now there are images named abc.jpg in those zip files. The zip files may be in any folder or in any subfolder so its difficult to ...
4
votes
3answers
1k views

Is there a command to list the compressed file sizes for files within a .zip file?

I'd like to see the absolute size in bytes of each file that has been compressed into single zip file. Having read the zip man page, I'm not sure that that utility can do it. This is on Mac OS X. ...
4
votes
2answers
1k views

How do I create a ZIP archive that preserves only the structure of the target directory and below?

I need to create a zip archive where the unzipped result preserves the directory structure from the specified directory down. I also need to do this without actually switching to the directory. My ...
4
votes
3answers
2k views

speed up gzip compression

Is it possible to speed up the gzip process? I'm using mysqldump "$database_name" | gzip > $BACKUP_DIR/$database_name.sql.gz to backup a database into a directory, $BACKUP_DIR. the manpage ...
4
votes
3answers
123 views

Bash: Zipping/grouping files by common substring

I have about 100 files. They are named like this. 3000_ABCD_XXXXXXX.csv 3000_ABCD_YYYYYYY.csv 3000_ABCD_XYXYZYZ.csv 3000_EFGH_XXXXXXX.csv 3000_EFGH_YYYYYYY.csv 3000_EFGH_XYXYZYZ.csv ...
4
votes
2answers
8k views

Excluding a directory when zipping files

I've got a bash script that does something like this: zip -0 ../backup/backup.zip \ -r ./* \ -x \*CVS\* \ -x *Thumbs.db* \ The directory it's backing up is a SVN archive (it used to be CVS back in ...
4
votes
1answer
7k views

Find a file in lots of zip files (like find command for directories) [duplicate]

Possible Duplicate: Find recursively all archive files of diverse archive formats and search them for file name patterns I need to search for a file in all zip files in a directory. Is ...
4
votes
2answers
698 views

Find recursively all archive files of diverse archive formats and search them for file name patterns

At best I would like to have a call like this: $searchtool /path/to/search/ -contained-file-name "*vacation*jpg" ... so that this tool does a recursive scan of the given path takes all files with ...
4
votes
4answers
503 views

unzip file, which directory was created?

Objective: After expanding archive a.zip by using command unzip on Ubuntu 12.10, assign the name of the folder a.zip expanded to to bash variable v. a.zip is assumed and guaranteed to expand to a ...
4
votes
2answers
571 views

Help with unzipping a .dd.gz, possibly corrupted

I recieved this file that I was told was a copy of a hard drive (or disk). The file is "sheeva-mem.dd.gz". I tried to unzip the file in a linux Fedora machine. This yielded "unexpected end of file". ...
4
votes
3answers
270 views

How to tell if a file is being downloaded by wget?

I use wget to download files (most are zip files) automatically for me during the night. However, sometimes in the morning I find that a few files cannot be unzipped. I don't know why this is ...
4
votes
1answer
3k views

What's the difference between gunzip and unzip?

What is the difference between gunzip and unzip? Tried to search but couldn't find anything relevant with this.
4
votes
3answers
617 views

How can I list all *.doc files in a Zip archive, including files in subdirectories?

I have Zip files, that might look like this: $ zipinfo -1 zip.zip doc.doc dotx.dotx xls.xls ppt.ppt txt.txt c.c subdir/subdir2/doc.doc subdir/xls.xls subdir/ppt.ppt subdir/c.c subdir/txt.txt ...
3
votes
3answers
289 views

Setting execution right to whole directory - is it good or bad idea?

I have a zip file containing lot of files and directories for a certain application which should be running on Linux. Some files needs to be set as executable, but the zip file format afaik does not ...
3
votes
4answers
319 views

Create directory if zip archive contains several files

If an archive contains several files in the root directory, I'd like to create a directory named after the file name (without extension). If an archive contains just a directory, then I'd like to ...
3
votes
4answers
970 views

Change working directory

I'm trying to compress a directory at /home/cyrus/sql And I wanted to change the working directory when zipping the folder: / $ zip -b /home/cyrus sql.zip /home/cyrus/sql But when I check the ...
3
votes
4answers
785 views

How to zip recursively all subdirectories that only contain text files

I have a backup from a disk that contains data files and analysis. The dir structure and names are not really consistent. To save space, I would like to zip all the subdirs that only contain data ...
3
votes
2answers
273 views

Linux Need Basic Libraries Without Internet

So I've been battling with my debian install lately, it doesn't have the firmware for either eth0 or wan0 NIC's. However, I got a firmware.zip file that I need to extract to /lib/firmware. The problem ...
3
votes
2answers
242 views

Create Zip for each subfolder but containing only matched files

I am trying to figure out how to create a zip file for each subfolder containing only files that match my criteria. For instance I have: Folder1 Folder2 Folder3 Each folder contains the same set ...
3
votes
2answers
655 views

Search for files with a specific size inside recursive zipped archives

I have a folder with several files. These files are either .xml or .zip files. These .zip files contain .xml and/or .zip files. These .zip contains also .xml or .zip, and so on... until we finally ...
3
votes
2answers
1k views

How to create multiple zips from a directory containing a million xml files?

I have a directory containing million xml files. I want to create multiple zip files containing n number of xml files. For ex: if n = 10000, then I want to create 100 zip files i.e. each zip file will ...
3
votes
1answer
637 views

Encoding of a zip file

When I extract some file (mp3) with japanese or korean characters within its filename on Windows, they appear normally, but when I extract it on Linux (Ubuntu/Mint) they appear as something like this ...
3
votes
0answers
412 views

ZIP password finders for Linux?

I'm trying to extract ZIP files for an encrypted archive I've forgotten the password for. So far I've found the tool fcrackzip which does what I want, but its own manpage states that it has numerous ...
2
votes
3answers
165 views

zip a directory that name start with `-` [duplicate]

How can I zip a directory like -foo? $ zip "-foo" "-foo" shows only help page. I think -foo is recognized as a options, but I don't know how to solve it.
2
votes
2answers
206 views

What scripting language can I use to automate a concatenation & zipping process?

For a project I'm doing I need to concatenate and compress (with zip) many (midi) files and compare their sizes. I've thought there must be some language that allows me to do something like this: ...
2
votes
2answers
124 views

Zipping files two by two

I have a directory that has 800 files like this: file1.png file1@2x.png file2.png file2@2x.png file3.png file3@2x.png ... etc I need to create zip files like this file1.zip (containing ...
2
votes
1answer
389 views

unzip two different kind of file extensions

Note here, .zip and .jar is just an example, my file extensions are different. Suppose I have a directory which can contain number of zip files a.zip b.zip c.zip AND/OR z.jar x.jar y.jar along ...
2
votes
1answer
1k views

How to zip individual files from different directories in one line?

I want to zip numerous files from different directories(paths) in one line. How can I do that?
2
votes
3answers
806 views

Zip contents of some subfolders but not others

I would like to use the unix zip command to zip a directory. Let's say the directory is structured as follows: dir1/ dir1/dir2/ dir1/dir2/file1 dir1/dir2/file2 dir1/dir3 dir1/dir3/file1 dir1/file1 ...
2
votes
3answers
51 views

How to know the path to a specific file in a zip archive, without extracting it?

I only know the filename but not its exact location. I would like to extract only that file from the archive. And I need to know its location in the archive.