I have a lot of files with .BRIK extension that take up a lot of space and need to be gzip. However, the files are scattered in multiple folders and few-level deep. I cannot find an answer to gzip *BRIK without doing one folder at a time.

Any suggestion?

So far, what I have been doing is just gzip *BRIK on each folder

  • find /blah_directory -iname *.BRIK -exec gzip {} \;
    – Bib
    Jul 27 '21 at 19:05
  • You can do several folders in parallel, but I am not sure if that helps. In other words, it is not clear to me what suggestions you want. Jul 27 '21 at 19:06
  • How compressible are the BRIK'd files - its possible you will not gain much? Jul 28 '21 at 1:01
find . -name '*.BRIK' -type f -exec gzip --best -v {} +

This would find all regular files that have the filename suffix .BRIK in or under the current directory. For batches of these files, the gzip command would be called with the options --best and -v to compress the files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.