Compressing a Directory Tree: Fine-Tuning

Here's a quick little command that will compress () files in the current directory and below. It uses find () to find the files, recursively, and pick the files it should compress:

-size xargs 
% find . ! -perm -0100 -size +1 -type f -print | xargs gzip -v

This command finds all files that:

The -v switch to gzip tells you the names of the files and how much they're being compressed. If your system doesn't have xargs, use:

% find . ! -perm -0100 -size +1 -type f -exec gzip -v {} \;

Tune the find expressions to do what you want. Here are some ideas - for more, read your system's find manual page:

You might want to put this in a job that's run every month or so by at () or cron ().

- JP