[Baypiggies] Unlinking symlinks

Glen Jarvis glen at glenjarvis.com
Fri Apr 30 21:35:38 CEST 2010

I hate to ask such an absolutely simple question, but for what I'm doing I
have to be *absolutely certain* to get this right :)

When deleting symlinks, I think I've always used os.unlink() although it's
the same as os.remove().

I can't tell in the documentation, but I want to be abso-bloody-lutely
certain that I'm deleting the link and not the file that it points to. This
is for a very large file system clean-up on a data system that would be a
bear to replace. We wish to clean up specific symbolic links that I can find
easily, but not the files that they point to.

Is os.unlink() guaranteed to touch the symlink only?   Also, semantically,
is this "unlinking" a hard unlinking and therefore the same as remove (i.e.,
which would be easier for someone who is reading the code to understand/yet
still be accurate).


Whatever you can do or imagine, begin it;
boldness has beauty, magic, and power in it.

-- Goethe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20100430/b65053de/attachment.html>

More information about the Baypiggies mailing list