[CentOS] strange 'find' tool behavior

Tue Nov 20 01:12:12 UTC 2012
Gelen James <hahaha_30k at yahoo.com>

Thanks a lot.

 with -prune option, now the find command works too.

find . -type d -name '.svn' -prune -exec /bin/rm -rf '{}' \;

 From: Stephen Harris <lists at spuddy.org>
To: CentOS mailing list <centos at centos.org> 
Sent: Monday, November 19, 2012 4:52 PM
Subject: Re: [CentOS] strange 'find' tool behavior
On Mon, Nov 19, 2012 at 04:44:31PM -0800, Gelen James wrote:
> [root at centos_58_test_box workingDir]# find . -type d -name '.svn' -exec /bin/rm -rf '{}' \;
> find: ./.svn: No such file or directory

"find" is attempting to open the ".svn" directory to see if there are
any subdirectories to work on but it can't because you just deleted it.

You either need "-prune" to stop it going further down the tree or "-depth"
to tell it to go down the tree first before running the -exec


CentOS mailing list
CentOS at centos.org