Compress multiple files individually with Gzip Compress multiple files individually with Gzip linux linux

Compress multiple files individually with Gzip


gzip */*.txt

But the extension for each file will be .txt.gz, as gzip uses it to know the original filename.


The following will work even if you have sub-directories. E.g. dir1/dir2/.../foo.txt

find . -type f -name "*.txt" -exec gzip {} \;