English Idiom in Unix: Directory Recursively

Chris Angelico rosuav at gmail.com
Sun May 22 18:46:26 EDT 2011


On Mon, May 23, 2011 at 6:22 AM, Xah Lee <xahlee at gmail.com> wrote:
> Xah wrote:
> «In the emacs case: “Recursive delete of xx? (y or n) ”, what could it
> possibly mean by the word “recursive” there? Like, it might delete the
> directory but not delete all files in it?
> »
>
> Jonathan de Boyne Pollard wrote:
>> It might *try* to delete the directory but not any of its contents,
>> yes.
>
> you mean theoretically you see a possibility if the dir is implement
> as stilted as unix, but never in your life you find yourself might
> want to do it?

There's a difference between working with a directory itself and
working with files inside it. Generally, if you copy or delete a
directory, you will want to recurse. But if you want to, for instance,
wipe out all files whose names end with a tilde, then you might want
to recurse and you might not. So it makes sense to offer the user a
choice, and if recursive action is the only one that makes sense, at
least acknowledge that the operation might take an arbitrarily long
time. (Ever done a recursive operation on / on a large file system?
Takes just a little bit longer than a non-recursive one under the same
circumstances...)

Chris Angelico



More information about the Python-list mailing list