iTunes Local Files Playlist

I was recently traveling with my laptop and wanted to listen to some music. Most of my music is on a server at home, but when buy new music from iTunes or rip a CD, the default place for it is the Music folder on my laptop's hard disk. I move music to the server periodically, so there's usually a sampling of recent stuff on my laptop. I wanted to listen to some of this, but how to find it?

iTunes doesn't expose the file's location as one of the columns you can sort on, nor as one of the fields you can filter on in Smart Playlists. It looked like building this playlist within iTunes was out.

But iTunes also exposes actions in Automator, the Mac's often overlooked GUI based scripting tool.

Here's how to build an Automator action that will make a playlist in iTunes for all the music in a particular folder.

Launch Automator, and create a new Custom workflow. What this workflow is going to do is take a particular folder, find all the items in that folder, and add them to a playlist. This is very straightforward in Automator.

The first thing you want to do is get your Music folder. Use the "Files & Folders" / "Get Specified Finder Items" action for this.


Once you find it, drag it to the pane at the right. You'll see the Get Specified Finder Items panel and its UI.
You could create a workflow that asked you for the folder to import, but in my case I always want to import the iTunes Music folder. Click the "Add..." button and add that folder. Now that panel should look like this:


Now that you've picked the folder, you need to get the contents of this folder, and all its subfolders. "Get Folder Contents" will do this for you.


Drag that into your workflow, below the first one. Make sure you select "Repeat for each subfolder found". And this feeds into the last action in the workflow: Adding the files to an iTunes playlist.


Select an existing playlist or create a new one to add the files to, and you're done. The final workflow should look like what's pictured here:


You can run this workflow from Automator, or save it to disk so you can double-click it whenever you need to refresh this playlist.

This workflow doesn't distinguish between music, podcasts, movies, or anything else that might be in your iTunes Music folder. If you want to filter this playlist so that it just shows Music, it's easier to do that in iTunes than in Automator. Create a new Smart Playlist that gets files from the playlist you just created and only includes music, for example:


If you're interested in Smart Playlists and playlist management I'm working on a whole series on that.