iTunes Library Auto-Update Mac OS X

July 4th, 2007, filed under Apple, Articles, General

We all enjoy music, right? Playing your favorite music on a computer isn’t difficult. But what if you are a Mac user having hundreds of GB’s of MP3 files on an external harddrive?

Why

When I bought a new MacBook it came with iTunes as the default (and probably best) music player from Apple. I’m not going to discuss what music player is better. People claim you’re able to work with an Apple right out of the box, so iTunes it is.

Having my music stored on an external drive will keep my laptop’s harddrive clean and gives me enough free disk space for storing documents, pictures, games, videos…you know, fun stuff.

The problem

Like many people I prefer having my own folder structure which is used to organise all of my music. However, smart people at Apple haven’t included an option that will let iTunes synchronize with a custom folder. Luckily we can use Automator to do this for us. Imagine adding hundreds of CD’s manually to your library!

Here’s my situation: Apple MacBook (running iTunes 7.2) and a LaCie 350 GB USB External Drive (containing all of my music).

The automator script

I’m using a total of 3 actions:

  • 1) Ask for Confirmation
  • 2) Find Finder Items (optional ‘date modified’ check)
  • 3) Add Files to Playlist

Look at the screenshot to see detailed information about each action. The second action is the most important one. You will need to specify the main folder that holds all your music (in my case Music on the external drive named Nanako).

Criteria

I’ve added two criteria. One that searches for mp3 files and a second one (which is not mandatory) that will check for modification date (last 2 weeks). I’ve added this second rule, because reloading all our mp3′s will take a very long time. Using the second rule drastically decreases loading time and will only add songs that are modified during the last 2 weeks. Change the date according to your own preference.


Creating rules with Automator. Change them to your own needs. See full image

When running this script it will search inside your custom folder for all mp3 files that have been modified (in this case “added” to your folder) during the last 2 weeks and will add them to your iTunes Library.

Tracks that are no longer available in iTunes (e.g. because you’ve deleted a CD manually), as indicated by a “!”, can be removed using Super Remove Dead Tracks.

Installation & Usage

Download the Automator script here: automator-itunes-library-sync.zip

Note: The following may not work on OS X 10.6 Snow Leopard.


Location of where to place the script. See full image

Place this script in /Username/Library/Workflows/Applications/Finder.

If the workflow directories don’t exist, you have to create them manually. When done, the script will be available to you with a simple right mouseclick (on some free desktop space). Select Automator -> Synchronize Library and your done. When running this script for the first time, open Automator and disable the “Date Modified” rule because we want to add all the songs first. When done you can enable the rule again.


Activating the script with a right mouseclick. See full image

I know a lot of people are waiting for an iTunes with a built-in synchronization function. I hope this might solve the problem people have now until iTunes will have such a function. I’m no expert with Automator, so if you have any comments, or suggestions regarding this script, please use the comment form below.

Tip: Using multiple iTunes Libraries

Press and hold the option (alt) key when launching iTunes. Doing so will let you control multiple iTunes Libraries. I’ve got two libraries running, one with music on my external drive and another one with some songs stored on my MacBook.

Changelog

2008-01-11 – version 1.1

  • Changed the script to search for “type: audio”

2007-04-07 – version 1.0

  • First release

82 Responses

Excellent! Thanks much.

Posted by

What do you mean that it will be available by a simple right mouse click. I went to /”username” and added ./Workflows/Applications/Finder as these were not already there. I then extracted the “SynchronizeLbrary.workflow” into that path. I see no option to run this script anywhere. What might I be doing wrong??

Posted by

Opus: You probably placed the file in a wrong location. Here’s a screenshot showing the correct path to the workflow location. Now it should be accessible through right click -> Automator -> Synchronize Library.

Posted by

this worked well for me – but an odd thing has happened. every tune that i added using this can now no longer be found using azureus. i have most of my library open for peer to peer – and now its all saying “error: data missing” although it is all still there. everything that i add to itunes manually is fine.

Posted by

Hello, i have just bought a new MAC and tried to follow your instructions. I am lost when I try to add the application to my Library workflow, for some reason Workflow doesn’t appear. Am I doing something wrong? thx

Posted by

@ Federico: If the workflow directory doesn’t exist, you can create them manually. I’ve updated the text and added a couple of images to clearify things. Hope this helps.

Posted by

[...] Unpossibilities… » iTunes Library Auto-Update Mac OS X (tags: itunes script library mac tool updater) This entry was written by admin and posted on November 12, 2007 at 8:25 am and filed under Url. Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL. « links for 2007-11-10 [...]

Posted by

Have anyone tried this automator-script in OS X 10 .5 Leopard, Automator version 2.0 (153) ? Automator does not seems to be able to open this file. It just loads forever.

Posted by

Sorry for the last post. It was just my Automator that needed a restart. Seems to work fine in Leopard.

Posted by

Thnx Christian, nice to see it works in Leopard. I’m still running 10.4 Tiger and will keep using it for now.

Posted by

Thank you so much for making this.
A quick question: Will it add duplicate listings to the Library? Or does iTunes itself prevent that from happening?

Posted by

No, it will not add duplicates to your Library. Also, songs that are rated will keep their rating.

Posted by

Thanks Robert!
I also figured out you can “Save as..” an Application in Automator, makes it easy peasy after putting it in Startup Items.

I will pass this on to others!

Posted by

It seems only 86 of my over 4000 files is found and added into iTunes. I’ve removed the “date modified” criteria and also tried changing the location to my external disk. I hope there’s an easy way of solving this. Thanks for the script!

Posted by

@ Alex: Are the songs MP3 encoded? The script searches for songs with .mp3 extension only. If your songs have a different type of format you can easily adjust the extension with Automator.

Posted by

Yes, all my songs are mp3′s. I changed the script to search for “type: audio” instead, works fine. I just thought it was wierd that it didn’t find all files ending with “mp3″, even though that’s what the origial script is for. Thanks again for this, and let’s hope Apple comes to senses and add a “watched folder” in a near future.

Posted by

Thnx for the info Alex. I think the change you made works even better, allowing different filetypes to be added (that are supported by iTunes).

Posted by

This may be exactly what I am looking for.
My problem is this: We have 3 seperate user accounts on an imac and we each have our own itunes setup. All 3 accounts share the same music files stored on an external drive. I have been updating the tags from my account, but the changes do not show up in the other 2 accounts. By running this automator script on each account, would the tag changes in itunes be updated to the newly enter data?

Posted by

@ brettdog: No, once the files are added to the iTunes Library they will not be readded.

You might want to try the following AppleScript: Refresh Selected Tags

Download and unzip the file. Put the file in “/Username/Library/iTunes/Scripts/”. From iTunes you will now be able to use the script from the script icon in the menu bar.

Posted by

Hi,

When I download the archive of automator I find a zip with two archives:
A file ._Synchronize Library.workflow
A folder Synchronize Library.workflow with /Contents/document.wflow inside.

I must admit that with only those files I don’t know how to install the script. Should I drag the folder? In your screenshot it seems to be a file…

Thanks for any help.

Posted by

Any chance you’re running Microsoft Windows? The above script requires Mac OS 10.4+.

Posted by

No, I’ve tried it in OS X.

My problem is, I don’t know what I should do with the zip file. I’ve tried to unzip it with the command line but without much success…

Thanks.

Posted by

@ Guillermo: Try unzipping by double clicking the downloaded zip file.

You can still use Synchronize Library.workflow. Similar to an OS X application, the automator script basically is a folder with package contents (e.g. /Contents/document.wflow). Just drag the Synchronize Library.workflow to the appropriate folder as desribed above. Double click on it to start Automator and adjust the script to match your own preference.

Posted by

No, I can not find any Synchronize Library.workflow in the zip. I only have a folder when I doubleclick in the zip file:

# ls -l /home/me/Library/Workflows/Applications/Finder/
drwxr-xr-x 3 me me 102  Synchronize Library.workflow
-rw-r--r-- 1 me me 2927 automator-itunes-library-sync-v1.1.zip

# ls -l /home/me/Library/Workflows/Applications/Finder/
  Synchronize Library.workflow/Contents/
-rw-r--r-- 1 me me 12418  document.wflow

Anyway, I think the problem might be the mac is an OS X 10.3.9, and Automator does not seem to be included for that version.

Sorry for this, I have lot’s of experience with Linux and Windows, but none with OS X, no matter how close to a UNIX system it is…

Thanks.

Posted by

I think you’re right on the problem. Automator probably came first with OS X 10.4.

If you’re ever going to upgrade to a newer version, be sure to give it a try :) I’m still using 10.4 (not going to upgrade any time soon) and have no experience with 10.5 (Leopard), but people say the script works fine.

Posted by

Can I use the synchronizer also with the library on a remote server, where other users also add songs?

Just click synchronize and all orphan songs are picked up by the itunes library? When I start up the program, it says it needs an external drive.

Thanks,

Posted by

Yes you can. The location of the library files doesn’t really matter. You do have to make sure that the library on the remote server is active in iTunes when updating (you can switch between different libraries holding the option key while starting iTunes).

This script only adds songs to the library according to a set of rules, e.g. location, date modified etc. So don’t worry about losing or overwriting current songs in the existing library. All you need to do is open this script with automator (right click on the script and select “open with automator”) and change the location of the songs. I think it’s even possible having multiple users on different Mac’s use this script and update one single library.

Here’s a screenshot showing what you could edit.

The message displayed on startup is only a reminder to myself, making sure I have my drive connected :) You can change the text yourself, or completely remove it.

Hope this helps ;)

Posted by

What if you don’t remember when you ran this script the last time. I was hoping the script could use a touch file as an option to the dates.

Posted by

Hi,
I’ve ran automator and the only files that are synching with my itunes are ones that are not within another folder. any files that are within a folder named after the album/artist they are from will not synch.
what am i doing wrong?
thanks

Posted by

@ Kabuto: Like Patient said, you can save the automator script as an application. Then you can create a new weekly iCal event that’ll run this application. At the moment I don’t see any other solution.

@ Lauren: Are you sure you’ve changed/removed the “date modified” field with Automator? Please check some files that won’t get synced and look for the field “Modified”. The default script will not add files older than 2 weeks.

Posted by

Excellent.

I actually did this myself, and then googled to see what the deal was and stumbled on your site.

I’ll say it: I download a lot of music. It doesn’t matter from where, but they come in folders with an sfv, nfo and m3u file ;)

Anyways, I wanted to have my music automatically added to itunes when I dragged it to a folder. Without much luck doing the above, I found a better way that works.

http://img.skitch.com/20080405-da1tbbj346yfba6d7cdi8ubtqx.jpg

Create the above in Automator, save it as a plug-in, select folder actions and pick the folder you want the action to run from. I’ve tested it to my needs, and found that it does exactly what I want it to. I download my music to desktop, make sure its neat and tidy, then drag to my ‘incoming’ folder and bam; iTunes pulls it and it’s ready to listen to.

If you like the idea of doing the library sync, I’ve also created my ‘own’ version from Robert’s right-click (GREAT) idea:

http://img.skitch.com/20080405-egk8sappy1sbfep49tup8sa6fp.jpg

Posted by

Hi,

After I give confirmation, it is giving me an error in the results pane that says, “The action ‘Import Files into Itunes (Add Files to Playlist)’ was not supplied with the required data. I’m thinking maybe this has something to do with the fact that I’m trying to do this from a windows formatted external HDD. Does this script only work when the HDD is formatted for Mac? Nothing got imported.

Also, I assume all subfolders are searched as well for music files as I have multiple levels of folders inside folders that would need to be synced too.

Thanks!

Posted by

Hi Jeff! It should not matter what type of harddrive you have. I’ve done a test with a standard MS-DOS formatted USB-Stick and it works flawlessly. Your type of HDD is not the problem. Have you set the proper location (nr. 2) where the script has to search? The reason I ask this is because of the error saying “…was not supplied with the required data”, which makes me think it’s searching in a non-existing location and returning no results.

And yes, subfolders are searched for files :)

@ Zac: Looks very nice, and probably very useful for alot of people. Of course the downside is having iTunes manage the file locations. But that’s something many people don’t mind. As long as you have the ID3 tags neat and tidy, just like you mentioned ;)

Posted by

Thanks, works (almost) great on my 10.5.2. Just wondering how to select multiple folders (a to z) to update to iTunes library, but not other folders (like ‘to be sorted’) in same root folder… I would not like to add all alphabets to the automator script, but it seems I have to…

Posted by

Nice one Michael! Works a treat.

Posted by

Can someone tell me what I’m doing wrong? I got the workflow to come up just as published, but when I point the search to my music folder on my external drive, it finds no new files to add to the library, even though I just added some 10 minutes ago. I played around with the search criteria to “created since yesterday,” even eliminating this criteria altogether. Really, it seems no matter how easy I make the criteria, it still finds new files. It does find new files in my Music folder on my internal drive, where my library is located though… wait a minute, does one’s library have to be located in the same place as the search for this to work?

Posted by

Ok, I was just having the same problem as David. The issue for me was that I was using the Automator action “Add Songs to Playlist.” The action to use is “Add files to playlist.” A subtle but important difference.

Posted by

Ok… I’ve updated the automater script to run “Super Remove Dead Tracks” right after the import of the music into iTunes.

The reason why:
I use my iMac to download music and organize it in my own preferred folder structure. This folder structure is automatically synced to my MacBook using ChronoSync. Since I’ve set the automator script to run as a folder action, the library on my MacBook is automatically updated after ChronoSync has synced up the folders/files.

Now… when I change a tag or album art on my iMac, ChronoSync picks this up and starts replacing the old file with the new file on the MacBook. Then the Automator script springs into action. It will not re-add the file but the “Super Remove Dead Tracks” AppleScript will run too.. scanning all the files if they are still present. This script has the nice side effect that all tags will be updated in the music library list!!! So on a change on the iMac side.. everything is mirrored on the MacBook side automatically including file removals, tag updates etc. I’m not sure if play count is updated as well… but that’s not important to me.

I hope this post will help people with a similar setup. ChronoSync can be substituted by any other way of syncing files.

Posted by

For the LOVE of God, when is someone going to make it possible to sync folders in Finder with Playlists!????? Doug Scripts has this script, except its BACKWARDS!!! Here is the link:
http://dougscripts.com/itunes/scripts/ss.php?sp=syncplaylistfilestofolder

Can anyone figure out how to make it so my playlists will sync according to my folder? … not Vice Versa Like he has it!?

If not, then APPLE… F****** MAKE IT POSSIBLE TO “WATCH” FOLDERS, OR SYNCHRONIZE FOLDERS WITH PLAYLISTS!!!! PLEASE. You are slacking.

Posted by

Does this workflow allow synchronization over a local network? (ie. Go > smb://ServerName/ShareName) I’ve tested it several times and the workflow fails on step 2 (Find Finder Items), although when I checked the connection Finder displayed a valid connection to the shared folder. Is there an easy fix or will I have to find some sort of software to manage iTunes Library synchronization?

Posted by

Thanks for the tutorial Robert! While it still wonders me why this is no standard functionality built in iTunes, I’m very glad how to do this myself. For me it’s a first to the Automator. Being a hard-core Windows user for more than a decade, I feel that the Mac suits me better every day…

Thanks again.
Corné.

Posted by

Thank you so much! I’ve been looking for an easy fix for this problem for a long time.

Posted by

Superb. This has been annoying me for months. Works a treat – thanks very much.

Next problem to fix is removing duplicate tracks. Anybody know a reliable routine for that?

Posted by

Works pretty awesome, thank you!

Posted by

Your background is gorgeous, where did you download it from? could you please share a link =)

Thanks
-Greg

Posted by

@ Greg: You can download the background at Pixelgirl Presents.

Posted by

So, did you make that gorgeous desktop background?

Posted by

Thanx Thanx Thanx Thanx Thanx!!!!!! :D

Posted by

ok So I’ve read through the posts and have even gone as far as changing the set-up based on others recommendations. I problem I’m having, that others have add is…
The action “Import files into itunes” was not supplied with the required data.
I allocated the find finder items to a folder on my external but it wont pick up the files. When allocating it to a folder on my internal it works fine. Help!! I’ve read through the posts and nothing have worked. My external is partitioned to Mac Os Extended (Journaled).

Posted by

I’ve also read through all the posts and am getting the same “ ‘Import files into itunes’ was not supplied with the required data” error in Automator. I get the error even if I point to an internal drive (which is where I store my music files). Any help would be deeply appreciated.

Posted by

Doesn’t seem to be working if you have your music on a networked server…

Posted by

I’m also getting the “was not supplied with the required data.”… I’m on Leopard trying to sync with an external drive. Would love any help on this issue.

Posted by

Have you already tried to re-create the workflow with Automator yourself? You can use the search function to find the appropriate rule. Here’s a screenshot with the rules you need to use.

Posted by

I am completely new to mac (I recently bought a macbook) running newest OS. Im really not sure how to even begin getting into automator etc.

Is ther any one out there who can give me a more detailed walkthrough

Posted by

Anyone fancy a video tutorial?

Posted by

I was able to successfully update networked audio folders using the “Import Files into iTunes” action instead of the “New iTunes Playlist” action.

Posted by

Amazing mate.Very usefull.Thank you very much!

Posted by

i have installed macfuse on my mac with a windows formated ntfs drive i cant seem to get the automator to run i have tried it on other macs with external drives formatted to mac os and they work fine, could there be a problem with the way the date format works on the ntfs drive

Posted by

Thank you very much. I wasn’t even aware Automator could do so many things!

Posted by

Everything is fine and works well under Leopard. You are a genius!!

Posted by

Automator option doesn’t show up with right click on 10.6 :(

But yet works running through the automator program

Posted by

I read: …”Press and hold the option (alt) key when launching iTunes. Doing so will let you control multiple iTunes Libraries. I’ve got two libraries running, one with music on my external drive and another one with some songs stored on my MacBook.”…

Which is weird. I tried to do the same thing but it didn’t work: whichever library I choose when starting iTunes, the Media Folder Location in Preferences would always point to the same drive and folder. When I changed it, it was changed for every library!

Posted by

hey,

i think this version doesn’t work anymore with snow leopard, or does it?
because there is not even a possibility to open the automator with a rightklick.

thanks for an answere!

Posted by

The “right-click” option isn’t mandatory for the script to function properly. It’s just a simple trick to have quick access to the Automator script ;-)

As mentioned before you only have to create the Automator script. See the screenshot for the instructions.

Posted by

thank u very much!
everything’s perfect now = )

Posted by

“Import files to playlist” is not an option for me. I have “Import songs to itunes” and “Import files into itunes” Are either of these the same. I am getting the same error “Import files into itunes’ was not supplied with the required data”

Anyone know what’s going on with this?

Thanks for your work!

Posted by

Nevermind., got it! Thx

Posted by

@ paul: The error may have been caused by an incorrect “where” location to load the files from.

Could you tell me how you fixed the problem? There are several other people that have the same problem as you did and probably could use your info ;-)

Posted by

Hello!

I have another question, instead of adding music files into itunes from an external harddrive, I would like to use a special folder (dropbox folder). But it should be the same but instead of the external harddrive I say the automator to find finder items which are music files.

Every thing works fine but when I chose the aspect that I only want to chose files which have been modified within the last 2 weeks I have the problem, that sometimes I have files which are modified a longer time ago but are new to me, and so these files won’t get improted into iTunes. Do you have an idea how to change the timestamp or to make it possible that it only tries to import newer files. You are right the progress of reloading all files will take too much time!

And I am using Snow Leopard, I can’t use the right mouse click on my desktop to chose automator! Do I need to activate it somewhere?

Thank you very much!

Markus

Posted by

Hi Robert, does your script work with snow leopard? Put the script in the (manually created) folder worflows/Applications/Finder. However nothing appears when right clicking. Different location needed? Does language play a role (English folder name/dutch OS)

Posted by

@ Markus: I’m also familiar with the problem that some files are modified a longer time ago than two weeks. These files are not synchronized.

If you are experienced with the Terminal you could try the following command (execute it in the drop box folder) to change the modified timestamp to the current date:

find . -type f -name 'test.txt' -exec touch `date +%m%d%H%M` {} \;

I don’t know if the above problem can be fixed using Automator. I’ll have to look into it.

@ Frank: It seems the contextual menu option is no longer supported in 10.6 Snow Leopard. Since I’m still on 10.4 I don’t know how to solve this problem.

You may find the solution on this page: automator-and-finder-interactions-in-os-x-10-6

I’ve updated my post concerning this issue.

Posted by

In 10.6 SL it’s pretty easy to create a ‘service’ to automate the same task. So it works in snow leopard as well. I encountered one more problem: if you add music that was not modified the last 2 weeks but just transferred in the folder, of course it is not added in iTunes. Any way to bypass this (different criterium to select the recently added music?)

Posted by

This is absolutely perfect for my problem. If you put your music on an external hard drive and try to play a song while the HD is not connected to your mac, all of the songs on your iTunes library will have a small exclamation point next to them. This is incredibly annoying and will not auto-play a song unless it is double clicked on (you cant use the arrow keys to skip to the next song if it has one of these marks.) This automator script works PERFECTLY and is quick running. Thank you so much for your help.
-Carlin

Posted by

Hi there, great idea! Was soexcited to finaly find a tool to keep my library uo-2-date without the need to rbuild the entire !”·$%&/()=)(/&%$·$%&/()=? database! Installed the script but can´t get it to work… It asks me for iTunes 4.6 or higher (am running iTunes 10) .. Any tips?? Groet, Abel

Posted by

works like a charm! super (goed gedaan :-) ). thnx

Posted by

On my new macbook air there is not even a possibility to open the automator with a rightklick.

You answered this but I can’t open the link

The “right-click” option isn’t mandatory for the script to function properly. It’s just a simple trick to have quick access to the Automator script ;-)

As mentioned before you only have to create the Automator script. See the screenshot for the instructions.

Posted by Robert | October 26th, 2009

Posted by

Hi Robert,

I was wondering if you could help me or point me in the right direction.

As a preface I will describe my set-up. I am using a Mac-mini (8BG), with a 2TB fire-wire external HD as my media server. This external HD is shared across my home network. The EX. HD is the location for my iTunes library. Other computers on the network (all PC’s), use the exact same location / directory (2TB external HD) for their iTunes library.

The problems is, when I purchase iTunes content on one of the PC’s, although the file downloads onto the 2TB external HD connected via fire wire to the Mac-Mini, when I use Apple TV (which is using the iTunes library of the Mac-mini), which is what I use as my media “interface”, it will not “see” the file because I have not added it to the library on the Mac-mini (remember the file was purchased from a PC whose library resides at the same directory / location as that for the Mac-mini).

How can I configure the Mac-mini to at a keystroke scan for or import new files in my iTunes library?

Many thanks for any help or suggestions.

Simon

Posted by

academia.edu

Unpossibilities… » iTunes Library Auto-Update Mac OS X

Posted by

Disk Cleaning Software

Unpossibilities… » iTunes Library Auto-Update Mac OS X

Posted by

livejasminbook.com

Unpossibilities… » iTunes Library Auto-Update Mac OS X

Posted by

Read Full Report

Unpossibilities… » iTunes Library Auto-Update Mac OS X

Posted by

o-disk.net

Unpossibilities… » iTunes Library Auto-Update Mac OS X

Posted by

Have your say

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

You must be logged in to post a comment.