find(1) removes as it should a directory, but after this it complains about

Yuri Pankov ypankov at fastmail.com
Mon Apr 20 09:09:31 UTC 2020


Matthias Apitz wrote:
> El día Montag, April 20, 2020 a las 10:26:20 +0200, Fernando Apesteguía escribió:
> 
>> Not sure it is, but GNU find (as of findutils 4.5.12) has the same behavior.
>>
>> As workaround, would -delete work fo you?
>>
>> find foo -type d -delete
> 
> This does not purge non empty directories.

Try specifying -d (depth-first):

$ mkdir -p a/b/c/d
$ find -d a -type d -execdir rm -rv {} \;
d
c
b
a
$


More information about the freebsd-questions mailing list