[CentOS] delete directories with find and exclude other directories
Gordon Messmer
gordon.messmer at gmail.com
Wed Feb 3 18:25:54 UTC 2016
On 02/03/2016 09:37 AM, Tim Dunphy wrote:
> If I try to exlclude the logs directory with the prune command I get back
> no results.
>
> root at ops-manager:/tmp/tmp# find . -type d -prune -o -name 'logs' -print
>
> What am I doing wrong?
You're not applying the prune command to items named logs, for one. :)
find . -name logs -prune -o -type d -print
find will crawl the directory. Items named logs will not be examined
further. Otherwise, if the item is a directory, its name will be printed.
More information about the CentOS
mailing list