Question about find - excluding directories

Paul Schmehl pschmehl_lists at tx.rr.com
Mon Oct 15 00:33:06 UTC 2012


I want to use find to locate files that don't belong to a certain user but 
should belong to that user.  But there are subdirectories I want to exclude.

I have tried using this, but it doesn't work:

find /path/to/dir -type d ! -uid num \( -type d ! -name dirname -prune \)

If I leave off the part in parentheses, it finds all the files I'm looking 
for but also files in the subdirs I'm not interested in.

If I add the parentheses, it doesn't find any files at all.

This is FreeBSD 8.3 RELEASE.

So how can I find these files without descending into directories I'm not 
interested in?

Paul Schmehl, Senior Infosec Analyst
As if it wasn't already obvious, my opinions
are my own and not those of my employer.
*******************************************
"It is as useless to argue with those who have
renounced the use of reason as to administer
medication to the dead." Thomas Jefferson
"There are some ideas so wrong that only a very
intelligent person could believe in them." George Orwell



More information about the freebsd-questions mailing list