exclude directories from find command

Roland Smith rsmith at xs4all.nl
Sun Dec 23 01:30:33 UTC 2012

On Sat, Dec 22, 2012 at 06:22:44AM -0800, Jack Mc Lauren wrote:
> Hi fellas
> How can I exclude specific directories from my find command ? I want to look for all files in the whole system except for those in e.g /extra directory. 
> I use this command to find all files, but how can I exclude /extra directory ?
> find / -type f

Try this:

  find / -type f -not -path '/extra/*'

R.F.Smith                                   http://rsmith.home.xs4all.nl/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20121223/9c233cdd/attachment.sig>

More information about the freebsd-questions mailing list