An AppleScript to copy iTunes songs to an archive server

Jun 06, '07 07:30:00AM

Contributed by: rasman1978

In my search for a solution to this problem, I have found that many other people find themselves in similar situations. Here's a basic statement of the problem:

Add to that my additional needs that... The best solution that I was able to find from searching the net was this one. This guy has his laptop using an iTunes library on a shared network drive on his server. Then, when he leaves the home network, he has a script to switch to a local library. The worst thing about that setup is that it could be complicated to add songs from your network server to your local library before disconnecting.

My solution is to add new songs to my local library, and then when I tire of them or need to free up some disk space, I send them to my shared library on the server. This way, I always have my newest music on my laptop, but if I want to listen to some older songs while I'm at home, I can connect to the shared network library inside iTunes. The trick to my solution is how I send the songs to the shared library, hence the title of this post.

I have written an AppleScript that will:

  1. Take the tracks I have selected in iTunes
  2. If any album art has been downloaded from the iTunes Store, and is therefore not embedded in the song file, embed album art into the song file
  3. Copy the files to a staging directory on the network server
  4. ssh to the network server and run an Automator script that will:
    1. Take all the files in the staging directory
    2. Add them to the iTunes Library, which copies the files
    3. Delete the files from the staging directory
Download script: Copy Songs To Archive Server.scpt [macosxhints mirror]

Download workflow: AddFilesToITunes.workflow.zip [macosxhints mirror]

More about the script and workflow available in this post on my blog.

[robg adds: I haven't tested this one.]

Comments (4)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20070531073105132