Requires Mac OS X 10.4 or higher
HAMSoft Engineering allows free use of this code and/or software in its "as is" condition. HAMSoft Engineering disclaims any liability of any kind for any damages whatsoever resulting from the use of this code and/or software. If you find it useful please consider making a donation to help HAMSoft Engineering stay in business.
download the command line tool
download the source project
Use this command line tool to add an image file as the custom icon to a file or folder. It can also be used to remove the custom icon.
[-h] show the help text
[-image "imagePath"] path to the image to be used for the icon
[-file "filePath"] path to the file to set the icon
[-removeCustomIcon] removes the custom icon for the file
1. This sets the image as the custom icon for the file:
SetFileIcon -image /path/to/image -file /path/to/file
2. This removes the custom icon from the file:
SetFileIcon -removeCustomIcon -file /path/to/file
Example usage of the tool with applescript:
Open this Script in your Editor