Re: ensure-directories aka create-directories Lassi Kortela 31 Jul 2020 13:31 UTC

> Assuming that mkdir and rmdir() are O(1), then Python makedirs and
> removedirs are O(n) in the length of their argument, whereas both
> shutil.rmtree (same as "rm -r") and the rmempty you mention str
> unbounded.

Yes.

> I'd like to keep things with unbounded time out of this SRFI.

Me too. I was questioning whether a Python-style more limited empty
directory remover makes sense to have in any library. Since they put it
in Python, we should start from the assumption that it is useful.

While there's some truth to the O(n) vs unbounded distinction, in
practice if you are unexpectedly deleting a huge stack of empty
directories there is something funny going on with your file system
anyway. More generally, programs with environmental dependencies do not
cope all that well when their environment is in an odd state.

Another distinction that would be useful in a deletion procedure is
stopping at file system (struct stat.st_dev) boundaries like rsync and
some other tools optionally do. The design space gets quite complex.