Skip to content
Advertisement

unzip a list of archives

I need to Unzipped a list of zip archives. These archives are not empty, in each one there are a lot of file. In my directory I have a lot of file zip archive and all have the the name in the same format: batch-download-ccd-1610959358275.zip but change only the numeric part. I can extract each archive with unzip command but if I try to extract all the archives together with this command unzip *.zip I get this message (For simplicity I report only the example where I try to extract two archives):

Archive:  batch-download-ccd-1610959358275.zip
caution: filename not matched:  batch-download-ccd-1610959397790.zip

Could someone help me please?

Advertisement

Answer

unzip takes only one archive as an argument, the remaining arguments are understood as files inside the archive.

Use a shell loop:

for zip in batch-download-ccd-*.zip ; do
    unzip "$zip"
done
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement