I have a zip file newfile.zip.
Archive: newfile.zip
Length Date Time Name
--------- ---------- ----- ----
0 2019-11-22 02:00 newdir/
33 2019-11-22 01:31 newdir/file1.txt
0 2019-11-22 01:31 newdir/dir1/
79 2019-11-22 01:45 newdir/dir1/file11.txt
35 2019-11-22 01:43 newdir/file100.txt
0 2019-11-22 02:00 newdir/file1
0 2019-11-22 02:00 newdir/file2
--------- -------
147 7 files
I want to extract the files with the extension .txt. I use this command,
$ unzip newfile.zip newdir/*.txt
This command extract the files,
newdir/file100.txt
newdir/file1.txt
but not the file, newdir/dir1/file11.txt
So how to extract it?
1 Answer
I have these folders and files:
.
├── a
│ └── file1a.txt
├── b
│ ├── file1b.txt
│ └── file2b.txt
├── c
│ ├── file1c.txt
│ └── file2c.txt
├── emptydoc
└── file2.txt
I got all of them compressed to compressed.zip.
If I want to unzip text files only, I run this command unzip compressed.zip *.txt and I only get the .txt files unzipped
unzip compressed.zip *.txt
Archive: compressed.zip
inflating: a/file1a.txt
inflating: b/file1b.txt
inflating: b/file2b.txt
inflating: c/file1c.txt
inflating: c/file2c.txt
inflating: file2.txt