bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: find: ... -ok rmdir ... No such file or directory


From: Bernhard Voelker
Subject: Re: find: ... -ok rmdir ... No such file or directory
Date: Sun, 28 Jul 2019 12:54:12 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

On 7/28/19 11:37 AM, 積丹尼 Dan Jacobson wrote:
> Please make this not make error messages.
> # mkdir /tmp/nnn
> # mkdir /tmp/nnn/ooo
> # find /tmp/nnn -type d -ok rmdir {} \;
> < rmdir ... /tmp/nnn > ?
> < rmdir ... /tmp/nnn/ooo > ? y
> find: ‘/tmp/nnn/ooo’: No such file or directory
> # find /tmp/nnn -type d
> /tmp/nnn
> 
> (The user cannot just use "-ok -delete.")
> $ find --version
> find (GNU findutils) 4.6.0.235-f254

find does not have an idea what rmdir does, and that its logic requires
depth-first search.  Use -depth:

  $ find /tmp/nnn -depth -type d -ok rmdir {} \;
  < rmdir ... /tmp/nnn/ooo > ? y
  < rmdir ... /tmp/nnn > ? n

  $ find /tmp/nnn -type d
  /tmp/nnn

Have a nice day,
Berny



reply via email to

[Prev in Thread] Current Thread [Next in Thread]