15.9. Compressing a Directory Tree: Fine-TuningHere's a quick little command that will compress (Section 15.6) files in the current directory and below. It uses find (Section 9.2) to find the files recursively and pick the files it should compress: -sizeSection 9.14, xargs Section 28.17 % find . ! -perm -0100 -size +1 -type f -print | xargs gzip -v This command finds all files that are the following:
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 the following: % 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 (Section 25.5) or cron (Section 25.2). -- JP Copyright © 2003 O'Reilly & Associates. All rights reserved. |
|