views:

16

answers:

2

I was trying to change the compression of some gzip files from the default compression level (6) or any other compression level to the maximum compression level (9).

Does anyone know how?

+1  A: 

I don't know how to detect files with a default compression level, but the easiest way to set a new compression level is to simply uncompress then recompress:

for f in *.gz; do gunzip $f; gzip -9 ${f%.gz}; done
Marcelo Cantos
A: 

found the solution but does not detect the compression level:

for file in ${files_to_process[*]}
do
    (gunzip -c ${file} | gzip -9 > ${file}.moarcompression) && mv ${file}.moarcompression ${file}
done
João Portela