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: Dale R. Worley
Subject: Re: find: ... -ok rmdir ... No such file or directory
Date: Sun, 28 Jul 2019 08:22:00 -0400

積丹尼 Dan Jacobson <address@hidden> writes:
> All I know is you need to document "in this case, find, for some reason,
> needs to needlessly check the directory is still there after the command
> it invokes exits, therefore one needs to add -depth" (I don't recall
> Unix find(1) had such weird habits.)
>
> Anyway, this "quirk" is not in the INFO manual.

Actually, it is in the info manual.  The default logic of find is that
it walks the file tree in "preorder", that is, it examines each
directory before examining the items in the directory.  Each examination
involves executing the operations the command line specifies.

The issue you see arises when the operations delete the directory,
because after executing the operations for the directory, find attempts
to list the items in the directory and discovers that (unexpectedly) the
directory doesn't exist.

As Andreas Metzler noted, the texinfo manual says that in this situation
you probably want to use -depth, so a directory is examined (and
removed) after find lists its contents and walks them.

See the various places -depth and -prune are mentioned in the manual;
they make clear what the processing logic is.

Dale



reply via email to

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