OS X: is there an application that can check for broken aliases in Finder?

3

1

I use a lot of aliases in my file system. Many original documents are placed in global repositories and I access them by aliases grouped in "tag" folders. Therefore, when I need to delete such a document, I need to check multiple tag folders to remove the aliases, which pains.

Is there an application that can check for broken aliases in Finder (or preferably, a particular folder)? Thanks in advance.

4ae1e1

Posted 2013-01-05T07:39:32.273

Reputation: 1 306

I'm not at my Mac to test this fully, but I believe that by using the command in a previous SU answer along with Hazel, you can create a rule to either alert you to broken links, color them, delete them, etc.

– fideli – 2013-01-05T07:55:40.780

@fideli find -L . -type l -ls only works with symlinks. – Lri – 2013-01-05T23:08:35.053

@LauriRanta Whoops, I thought Finder aliases are simply symlinks. Perhaps not. – fideli – 2013-01-06T00:31:12.520

Answers

1

Try running something like this in AppleScript Editor:

set l to {}
tell application "Finder"
    try
        alias files of entire contents of (POSIX file "/Users/username/Folder/" as alias)
        -- zero aliases results in an error, one alias is not returned as a list
        result as list
    on error
        return
    end try
    repeat with f in result
        try
            original item of contents of f
        on error
            --move contents of f to trash
            set end of l to POSIX path of (f as text)
        end try
    end repeat
end tell
set text item delimiters to linefeed
l as text

Lri

Posted 2013-01-05T07:39:32.273

Reputation: 34 501