When I do shell script “find /yadda/yadda/ -type f” , I sometimes end up with a file called “icon,” which errors AppleScript when I try to turn the results of find into an alias list. It’s easy enough to deal with, but I was curious what that icon file is, because it’s not in every directory. If I see it via the Terminal with the “ls -a” command, it shows up as “icon?”.
Its name is “Icon” plus return (ASCII 13), and I think it stores the icon for the given folder…
Thanks. That makes me curious why some folders have it, and other don’t.
It appears that only folders with custom icons have the “Icon?” file.
I recently wrote a script for removing custom icons from folders. Since the Finder still doesn’t support direct control of the icon family item property (as of Snow Leopard release), we have to resort to tricks to accomplish that task. Sveinbjorn Thordarson’s OSXUtils has two command line utilities (geticon & seticon) that can copy Icon familys from one item to another, and can be readily used within AppleScript via the ‘do shell script’ command. But they don’t allow you to remove a custom Icon. But deleting the “Icon?” file from a folder will do that. So here’s a simple handler that will delete a custom Icon from a folder if one exists.
do shell script "rm " & quoted form of ((POSIX path of theFolderAlias) & "Icon" & return)
tell application "Finder" to update theFolderAlias