[CentOS] delete directories with find and exclude other directories

Gordon Messmer gordon.messmer at gmail.com
Wed Feb 3 19:29:47 UTC 2016


On 02/03/2016 10:51 AM, m.roth at 5-cent.us wrote:
> Right, but a) I think I tried using prune 20 years ago... and b) I thought
> the o/p wanted to not deal with any directory whose name was logs. leaving
> off prune would get everything, which is perhaps a bit more useful.

I think you don't understand.  I was pointing out that the command you 
specified would print the name '.' and that is all.  It won't descend 
through '.' because you told it to prune all directories not named 
"logs".  That is, I'm trying to point out that it's your *logic* that's 
flawed.

OP was right in his thinking.  The correct way to approach the problem 
is to ignore (prune) the logs dir, and then to do something with the 
remaining directories.



More information about the CentOS mailing list