I am trying to remove a set of directories, excluding those that are in used and symlinked to elsewhere.
What is the most effective way to determine if a given directory is symlinked to?
I've tried os.stat(dir).mt_nlink, but it returns 3 even for directories I want to remove.
EDIT:
By symlinked to I mean this directory is a target of some symlink.