[CentOS] find with exclude directory

Sun May 11 17:30:18 UTC 2014
zep <zgreenfelder at gmail.com>

On 05/11/2014 01:06 PM, Tim Dunphy wrote:
> Hal & Jack
>
>  Both are perfect! Thanks
>
> [root at uszmpwsls014lb ~]# find / -print | grep -v digitalplatform | grep
> varnish
> /var/lib/varnish
> /var/lib/varnish/uszmpwsls014lb
> /var/lib/varnish/uszmpwsls014lb/_.vsl
> /var/lib/varnish/varnish_storage.bin
>
it might work reasonably for this particular case, but you should note
the limitations of such an approach.   specifically this would exclude both
/path/you/want/to/ignore/digitalplatform/varnish and
/path/you/want/to/find/digitalplatform/varnish

I'd also suggest using find / -name varnish,  dropping the second grep
and possibly using anchors with egrep to be very specific (e.g. | egrep
-v "^/ignore/this/path|^/ignore/another/path"