Creating a folder symlink

I've been fiddling about with Applescript recently. And since I have a problem with using iTunes (due to its lack of ogg and flac support), I thought about writing a script which would create a symbolic link to any new artists/albums I added to my music collection.

This would leave me with a list of the newest additions to my music collection as a list of folders in Music:New, for easy playing with Cog.

I wrote the script, but still haven't really gotten past the issue of my need to have a folder action to be recursive. So because I have a "Music:Artist:Album:" structure only new artists are added to my New folder. The only solution I have found is to add this script as a folder action to every Artist folder I got...

Anyways. To use it: ctrl+mouse a folder, select "Attach folder action" and use this script as that folder action. You probably want to edit the paths a bit as well before using it. Its not really production ready.

on adding folder items to this_folder after receiving these_items
tell application "Finder"
if not (exists folder "New" of folder "Music" of folder "kiowa" of folder "Users" of startup disk) then
make new folder at folder "Music" of folder "kiowa" of folder "Users" of startup disk with properties {name:"New"}
end if
repeat with i from 1 to number of items in these_items
try
set this_item to item i of these_items
set the dest to folder "New" of folder "Music" of folder "kiowa" of folder "Users" of startup disk if the container of this_item as alias is this_folder as alias then
make new alias file to this_item at dest
else
display dialog the "container is not root"
end if
on error error_message number error_number
display dialog the error_message
end try end repeat end tell
end adding folder items to

Be Sociable, Share!

You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

AddThis Social Bookmark Button

Comments are closed.