Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Apr 2020 12:09:26 +0300
From:      Yuri Pankov <ypankov@fastmail.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: find(1) removes as it should a directory, but after this it complains about
Message-ID:  <8d3cc614-6289-c55d-96ae-81b31941aa87@fastmail.com>
In-Reply-To: <20200420090614.GB30229@sh4-5.1blu.de>
References:  <20200420081627.GA30229@sh4-5.1blu.de> <CAGwOe2Z5hnkf4B0cJeRpvWqfOxnaKBz6dv%2BKne8MnedQ4otuOg@mail.gmail.com> <20200420090614.GB30229@sh4-5.1blu.de>

next in thread | previous in thread | raw e-mail | index | archive | help
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
$



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8d3cc614-6289-c55d-96ae-81b31941aa87>