Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Oct 2012 19:32:58 -0500
From:      Paul Schmehl <pschmehl_lists@tx.rr.com>
To:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Question about find - excluding directories
Message-ID:  <7651E6A84D436D388849B985@Pauls-MacBook-Pro.local>

Next in thread | Raw E-Mail | Index | Archive | Help
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




Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?7651E6A84D436D388849B985>