René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

Using find in a Unix Shell

Prune

This is a very common problem and many developers have come across it: There's a directory containing subdirectories which in turn contain subdirectories until a not specified depth. One directory is special in that it is a copy of all the other directories and it's called say mysave. Now, one want to operate on all say '*.html' files within this directory tree excepte on mysave. On a Unix shell, the prefered command for this is find.
But how do I tell find not to search mysave as well?
Use prune like this:
$ find -name 'mysave' -prune -o -name '*.html' -print
This command means: find all files. If the name of the file (or directory) is mysave, prune it (don't descend further in this subtree) OR if the name ends in html print it.

Executable Bit set

The following command finds files whose executable bit for the owner is set:
find . -perm -u=x -print