: Not knowing where else to ask about this tool, here goes:
: How is the -prune action supposed to work? The man page
: indicates that it should inhibit recursion of a selected
: portion of the directory tree. (Refers to "current directory"...)
: I get the impression that I could search the file system for
: a file name, but exclude looking into certain directories...
: but how?
: If I do a "find / -name usr -prune", it won't recurse the
: /usr tree, but then, it won't find anything except files
: named usr any place else. Not too useful, that form.
: --
: Dave Brown Austin, TX
Try
find / -path /usr -prune -o -print
which is shortcut for
find / -path /usr -and -prune -or -print
The expression is interpreted using the normal rules of logical OR (-or)
and AND (-and). AND is evaluated first.
If find comes across /usr, then "-path /usr" is true; and "-prune" will
skip the path, returning also true. Since "-path /usr -prune" is true,
find will skip to a new path. However, if find comes across something
other than /usr, then "-path /usr" is false; and "-prune" need not be
tested or acted upon. Since "-path /usr -prune" is false, "-print" is
evaluated, returning always true and printing the path.
Now, if you want to search for a file name, then try
find / -path /usr -prune -o -name filename -print
--