Skip to content
Advertisement

Find files with a string in filename and unzip

I have a folder full to zip files. Using linux terminal, I need to find files with a certain string in the zip file name and unzip only them to another folder. I tried the following but no luck.

find /some_folder/ -name "*[temperature]*.zip" | parallel unzip '/some_folder/unzippedfiles/'

First, the pattern is not matching and second, I am not sure if the output could be redirected to another folder. Could someone suggest a fix please? Thanks a advance

Advertisement

Answer

/some_folder/ must be absolute path:

find /some_folder/ -name "*temperature*.zip" |
  parallel 'mkdir -p /some_folder/unzippedfiles/; cd /some_folder/unzippedfiles/ && unzip'
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement