I am trying to unzip specific files from an archive.
Steps:
ZIP structure
Archive: folder/jce_policy-6.zip 9101 bytes 5 files
drwxr-xr-x 2.2 unx 0 bx stor 17-Nov-06 02:10 jce/
-r--r--r-- 2.2 unx 2663 tx defN 17-Nov-06 02:10 jce/COPYRIGHT.html
-r--r--r-- 2.2 unx 8386 tx defN 17-Nov-06 02:10 jce/README.txt
-rw-r--r-- 2.2 unx 2465 bx defN 17-Nov-06 02:10 jce/US_export_policy.jar
-rw-r--r-- 2.2 unx 2481 bx defN 17-Nov-06 02:10 jce/local_policy.jar
Copy JAR files:
unzip -o -j vendor/jce_policy-6.zip "*/*.jar" folder1/*.jar
Archive: vendor/jce_policy-6.zip
inflating: US_export_policy.jar
inflating: local_policy.jar
caution: filename not matched: folder1/*.jar
If I try unzip -o -j vendor/jce_policy-6.zip "*/*.jar" folder1/*
Archive: vendor/jce_policy-6.zip
inflating: US_export_policy.jar
inflating: local_policy.jar
caution: filename not matched: folder1/<list the files in the folder>
I googled as much as I could, but I am not sure I found the correct one. How can I do it?
I have a solution.
The above error indicates that you used the unzip command wrongly. Your shell expands the command ‘unzip *.zip’ as follows:
unzip a.zip b.zip c.zip
The solution:
unzip '*.zip'
Doing this shell doesn’t recognize it’s a wildcard character.
For me, the case was a space. I had to rename my project name and remove that space and done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With