Changing Folder/Group Icon via Applescript

Is there a way to change the icon of a group/folder from Applescript?

or

Is there a way to batch change the icons of a selection of groups?

I have a folder tree of 750 folders I created using VBA to name the folders from a column in an Excel spreadsheet. I know how to change multiple folder icons in Finder, but when I try to import the folders with my custom icon, DTPO replaces the icons with its default and, even stranger, a few icons I changed individually in DT several test imports ago. It even adds triggered scripts to some of my imported folders, which I also set several test imports ago, but have since deleted. Its like DT is remembering these folders somehow even though after each import attempt I deleted the folder tree. However, I think the import issue is a sideshow. If could just batch change icons in DT, I could clean this all up quickly.

Sorry, I asked for help too quickly. I was able to resolve the issue using the Finder batch change technique. The reason DT was “remembering” old icons and scripts was because I had exported my test folder tree from DT and there was a DEVONtechStorage file in the export (duh!). Also, someone had mentioned in the past (I did actually to try research this issue on this Board) that the icons of imported files/folders were smaller or stunted than if you set them from within DT. I was able to eliminate this by using a utility (iConvert Icons) to convert my icon image to an icns file before I used Finder to batch change the icons. The conversion apparently provides the resolutions needed by DT during import to display the icon as it appears in Finder.

Once again, sorry for the premature post.

You’ve got something abnormal going on. Importing and indexing should preserve the custom icon. (I just tested it and it’s working as expected in 2.9.15.) Have you rebooted recently?