troubleshooting Question

Using unzip with wildcards

Avatar of phirschybar
phirschybar asked on
Linux OS Dev
2 Comments1 Solution2283 ViewsLast Modified:
Hello,

I am trying to unzip all files that start with "MF" and end with ".zip" in a folder and have them extracted to another folder. They are password protected. Here is what I am trying:

for i in `ls -1 | grep .zip$`; do unzip $i -d $rPath/feeds/ -P 1048 -j -u; done

This is without the "MF" part. I am not sure how to do that yet... but simply trying the above for all .zip files, I get:

Archive:  IF20050817_160652_CND_1.zip
caution: filename not matched:  -P
caution: filename not matched:  1048
caution: filename not matched:  -j
caution: filename not matched:  -u
Archive:  IF20050817_160652_LSE_1.zip
caution: filename not matched:  -P
caution: filename not matched:  1048
caution: filename not matched:  -j
caution: filename not matched:  -u
Archive:  IF20050817_160652_MUL_1.zip
caution: filename not matched:  -P
caution: filename not matched:  1048
caution: filename not matched:  -j
caution: filename not matched:  -u
Archive:  IF20050817_160652_RES_1.zip
caution: filename not matched:  -P
caution: filename not matched:  1048
caution: filename not matched:  -j    

... and so on.  How do I do the above properly with all parameters and with including MF as the first two characters of the filename?
$rPath is the path I need... that part is working fine.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros