[Python-ideas] Have os.unlink remove directories on Unix (was: junction points on Windows)
Kim Gräsman
kim.grasman at gmail.com
Tue Aug 27 17:47:08 CEST 2013
On Mon, Aug 26, 2013 at 2:25 PM, <random832 at fastmail.us> wrote:
> On Mon, Aug 26, 2013, at 7:42, Kim Gräsman wrote:
>> I wouldn't switch to using os.rmdir, however -- if the path names an
>> actual directory rather than a symlink or a junction point, os.rmdir
>> will delete it, whereas os.unlink will fail with access denied (as I
>> believe it should.)
>
> Only if it's empty. You could at least replace whatever your
> _delete_junction_point function is with it.
I don't want to remove empty dirs, only links.
> And the fact that windows
> unlink() allows you to remove some (but not all) things that windows
> considers to be directories is already violating the principle of being
> thin wrappers around system calls.
Do you mean Python's os.unlink() here, or the Microsoft C-runtime's unlink()?
- Kim
More information about the Python-ideas
mailing list