find -L . -type l -delete

Andriy Gapon avg at icyb.net.ua
Thu Nov 13 06:33:53 PST 2008


on 13/11/2008 16:17 Eugene Grosbein said the following:
> On Thu, Nov 13, 2008 at 03:38:51PM +0200, Andriy Gapon wrote:
> 
>> Am I stupid or is our 'find' is seriously broken in one subtle feature?
>>
>> $ find -L . -type l
>> find all broken symlinks (target doesn't exists)
>>
>> $ find -L . -type l -delete
>> removes all symlinks!!!
> 
> Yes.
> 
>> FreeBSD 7.1-PRERELEASE amd64
> 
> This is pretty old and known problem:
> http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/90687

Wow, that's pretty tough.
I always relied on the following 3 step procedure:
1. find ... -print
2. verify output
3. find ... -delete
[Profit!]

But now I will have to re-tune myself to xargs.


-- 
Andriy Gapon


More information about the freebsd-stable mailing list