Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'A cleaner and safer alternative' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A cleaner and safer alternative
Authored by: jimTucson on Sep 28, '05 10:01:42AM

Nice solution, but it does require running Finder. Is there any way to access this information via python (or perl, or whatever) and direct system calls rather than by invoking Finder? Having to run a GUI-based app to get information used in a command-line script seems inelegant at best. If you can get at this information via a C program it should be available via something like python (if someone has written the necessary code).

[ Reply to This | # ]
A cleaner and safer alternative
Authored by: lar3ry on Dec 01, '06 01:00:01PM
I was thinking the same thing, actually, when I first started using Tiger.

The closest command line tool that can help is Tiger's mdls command, which uses Spotlight's database.

Unfortunately, while mdls can show you that the file is an alias (kMDItemContentType = "" or kMDItemKind = "Alias"), Spotlight's database doesn't seem to have the location where the alias points to, which seems to me to be a weakness in Spotlight.

I still have the remnants of the perl script that I started writing back then to do what this particular script does. I'm not happy having to run oascript to get the reference to an alias...

(By the way, the Spotlight attributes can be used in the shell script above to verify that the file passed to apath is indeed an alias.)


[ Reply to This | # ]