Sample Header Ad - 728x90

Estimate compressibility of file

6 votes
6 answers
4303 views
Is there a quick and dirty way of estimating gzip-compressibility of a file without having to fully compress it with gzip? I could, in bash, do bc <<<"scale=2;$(gzip -c file | wc -c)/$(wc -c gz file to disk; this way I can avoid replacing a file on disk with its gz version if the resultant disk space savings do not justify the trouble. But with this approach the file is indeed fully put through gzip; it's just that the output is piped to wc rather than written to disk. Is there a way to get a rough compressibility estimate for a file without having gzip work on all its contents?
Asked by iruvar (17005 rep)
Sep 16, 2014, 04:48 PM
Last activity: Aug 22, 2024, 12:45 AM