[Baypiggies] Unlinking symlinks

Brian Harring ferringb at gmail.com
Fri Apr 30 22:30:44 CEST 2010


On Fri, Apr 30, 2010 at 12:35:38PM -0700, Glen Jarvis wrote:
>    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).

unlink/remove are literally the same cfunction in the src.  Beyond 
that, unlink works on the targeted node only- it does *not* resolve 
through the sym.

~harring
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20100430/ec75a55c/attachment.pgp>


More information about the Baypiggies mailing list