[CentOS] find troubles

Robert Nichols rnicholsNOSPAM at comcast.net
Tue Oct 28 21:32:25 UTC 2014


On 10/28/2014 04:00 PM, Tim Dunphy wrote:
> Hey guys,
>
>   Sorry not sure what's wrong with this statement. I've tried a few
> variations of trying to exclude the /var/www directory.
>
>
> [root at 224432-24 apr-1.5.1]# find / -name "*httpd*" -type d \( ! -name www \)
> /usr/lib/httpd
> /usr/lib64/httpd
> /var/www/vhosts/johnnyenglish/httpdocs
> /var/www/lpaddevbkp/alchemist/namespace/system-config-httpd
> /var/www/lpaddevbkp/httpd

Well, no name that matches "*httpd*" will also match "www", so that last
term will never match.  What you want is the "prune" action:

       find / -name www -prune -o -name "*httpd*"

-- 
Bob Nichols     "NOSPAM" is really part of my email address.
                 Do NOT delete it.




More information about the CentOS mailing list