Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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

share|improve this question
    
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 '11 at 4:29
    
Indeed, I even hope(d) in some hidden OS option, or something. It seems a somewhat natural request. –  DaG May 13 '11 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 '11 at 4:29

2 Answers 2

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.

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.