You have a huge zip file with thousands of files in it. You want to extract a specific folder inside the zip, but you also want to exclude some files and folders from the extraction.
Assume that compressed_file.zip file contains the following folder and file structure:
You can check the zip content by unzip -l compressed_file.zip command.
- path/
- path/to/
- path/to/extract/
- path/to/extract/file1.txt
- path/to/exclude
- path/to/exclude/file2.txt
You want to extract just path/to/extract/ folder, but want to exclude any folders under exclude folder.
unzip compressed_file.zip path/to/extract/* -x *exclude*
When you run the command above, you will only get the following content.
- path/
- path/to/
- path/to/extract/
- path/to/extract/file1.txt
With the command above, only path/to/extract folders exist. Exclude folders do not exist.
By the way, the performance is lighting fast:) Enjoy!