Computer Science/Linux

How do I unzip multiple / many files under Linux?

알 수 없는 사용자 2011. 10. 17. 15:04

How do I unzip multiple / many files under Linux?

Q. I’ve lots of files in a directory called /disk2/images. All files are zip file format , so I am using following command:

unzip *.zip

Which is result into an error as follows:

caution: filename not matched

How do I unzip multiple / many files under Linux?

A. Linux or UNIX unzip command will list, test, or extract files from a ZIP archive, commonly found on MS-DOS systems.

When you want to unzip file using wild card, you have two options as follows.

Option # 1 : unzip multiple files using single quote (short version)

Type the command as follows:

$ unzip ‘*.zip’

Note that *.zip word is put in between two single quote, so that shell will not recognize it as a wild card character.

Option # 2 : unzip multiple files using shell for loop (long version)

You can also use for loop as follows:

$ for z in *.zip; do unzip $z; done