find help

I've been trying to figure out how to use find(1) to search for specific files...

According to the man page:

Code:
SYNOPSIS
     find [-H |    -L | -P] [-EXdsx] [-f path] path ... [expression]
     find [-H |    -L | -P] [-EXdsx] -f path [path    ...] [expression]

so I should be able to supply several paths with the '-f' parameter, but I should also be able to use:

Code:
OPERATORS
     The primaries may be combined using the following operators.  The opera-
     tors are listed in    order of decreasing precedence.

     ( expression )
         This evaluates to true if the parenthesized expression evaluates
         to    true.

     ! expression
     -not expression
         This is the unary NOT operator.  It evaluates to true if the
         expression    is false.

so I want to search from '.' but exclude tmp, which I thought I should be able to do using

-f . !tmp

but can't stumble upon the correct syntax. Is what I'm trying to do possible?

There is an example of the NOT operator:

Code:
 find / \! -name "*.c" -print
         Print out a list of all the files whose names do not end in .c.
 
scottro I tried the example in the link....

Code:
find /path/to/dest -type d \( ! -name tmp \) -print

but get:-

Code:
find: (!: unkown primary or operator

So maybe the example shown requires a specific shell or maybe it is for GNU find rather than BSD find....
 
Back
Top