Symlinks already present

Cameron Simpson cs at cskk.id.au
Sun Aug 30 22:23:31 EDT 2020


On 27Jul2020 20:20, Termoregolato <waste at is.invalid> wrote:
>Il 26/07/20 20:39, Dennis Lee Bieber ha scritto:
>>Since symbolic links are essentially just short files containing the
>>path to the eventual target file/directory, with an OS flag that the file
>>is a link
>
>Yes, I use them massively to give to a lot of directories a kind of 
>order, depending on their contents. It's simple to see if link is 
>broken, but not if they're duplicate

Hmm. If you're scanning them all, you can at least cache the (dev,ino) 
of the link target. So broken is stat-failed. Duplicate is 
seen-this-(dev,ino)-before. You only need the stat, not to (for example) 
resolve the path the symlink becomes.

You've probably thought of this already of cource.

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Python-list mailing list