2

Is there a way to (automatically) delete all aliases when the file they are an alias to is deleted?

3
  • You could write a script that removes all broken aliases on your computer but I'm sure you already knew that since you said "automatically" delete. Maybe have the script run every day? I'm interested to see if there is a solution as well.
    – styfle
    May 13, 2011 at 4:29
  • Indeed, I even hope(d) in some hidden OS option, or something. It seems a somewhat natural request.
    – DaG
    May 13, 2011 at 8:35
  • It's a very natural request - but it goes against the engineering that went into making an alias different than a link.
    – bmike
    May 19, 2011 at 4:29

2 Answers 2

5

No - aliases are a combination of a sym link pointing to a place as well as a unique file ID to track that file if it moves so the alias won't be broken if the file still resides on the original volume. (the file ID changes across volumes and an alias will only remain valid if the relative path is correct if and when the file ID half is broken by a deletion).

So - for this to work, the system actively tries to reconnect the alias after a delete of the original file by design so automatically deleting an alias would ruin that chance to reconnect.

Even though your question makes great logical sense, it amounts to a re-design of what an alias is engineered to do.

A hard link is what you want to use if you want it to go away when the file is deleted finally.

0

Not really as an alias could be on an external disk pointing to your normal disk. If the external is off line then that alias cannot be found when the original is deleted

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .