Unzip individual files from multiple zip files and extract those individual files to home directory
Posted
by
James P.
on Super User
See other posts from Super User
or by James P.
Published on 2011-08-11T14:33:08Z
Indexed on
2013/10/20
3:58 UTC
Read the original article
Hit count: 575
I would like to unzip individual files. These files have a .txt extension. These files also live within multiple zipped files. Here is the command I'm trying to use.
unzip -jn /path/to/zipped/files/zipArchiveFile2011\*.zip /path/to/specific/individual/files/myfiles2011*.txt -d /path/to/home/directory/for/extract/
From my understanding, the -j option excludes directories and will extract only the txt files The -n option will not overwrite a file if it has already been extracted. I've also learned that the forward slash in /path/to/zipped/files/zipArchiveFile2011\*.zip
is necessary to escape the wildcard (*) character.
Here is sample of error messages I'm coming accross:
Archive: /path/to/zipped/files/zipArchiveFile20110808.zip
caution: filename not matched: /path/to/specific/individual/files/myfiles20110807.txt
caution: filename not matched: /path/to/specific/individual/files/myfiles20110808.txt
Archive: /path/to/zipped/files/zipArchiveFile20110809.zip
caution: filename not matched: /path/to/specific/individual/files/myfiles20110810.txt
caution: filename not matched: /path/to/specific/individual/files/myfiles20110809.txt
I feel that I'm missing something very simple. I've tried using single quotes (') and double quotes (") around directory paths. But no luck.
© Super User or respective owner