Archive for the
‘Managing Files’ Category

December 20 '13 - 10:47 am
UPDATED: File Renamer v2.4

File Renamer will rename the files of the selected tracks (or the files of the tracks in the selected playlist) with a filename pattern that is formulated using the tracks’ tag data. Optionally, export a copy of the files to a chosen location and rename the files in that location.

This latest version supports literal bracket characters (ie: [ and ]) and provides a [play order] pattern “field” which will match the index of each selected track in its sorted order.

More information and download is here.

December 14 '13 - 1:36 pm
UPDATED: PDF Adder v4.2

PDF Adder is a collection of two scripts (it used to be three) that assist with adding PDF files to iTunes as “digital booklet” PDF tracks. Each provides a method for easily supplying Author (artist), Album, Category (genre), Year, Rating and Description tag data which is then applied to the newly-added PDF track entry:

  • Add as PDF to iTunes is a PDF Service workflow that, when installed, will be available in the PDF pop-up menu of the Print Dialog. It allows you to save the current document as a PDF file (from any application that uses the Print Dialog) and add it to iTunes.
  • PDF Adder is an applet/droplet that will let you choose or drag-and-drop an existing PDF file and add it to iTunes. It can be installed in iTunes’ Scripts folder for easy access from iTunes Script menu.

Each script displays a panel like this so you can provide tag data for the PDF:

Anything you can print, you can export as a PDF…and any PDF can be added to iTunes.

These latest versions are updated for compatibility with OS X 10.9. I also got rid of PDF Dropper and just made PDF Adder launch via double-click (or Script menu launch) or by drag-and-drop. Finally, Add as PDF to iTunes will use applicable tag data for the PDF metadata tags Title, Author, Keywords (Category/Genre tag) and Subject (Description tag).

I almost included an option to add PDFs to iBooks (see below, “iBooks is Not Scriptable. Much.“) but iBooks ignores PDF metadata except for Author and of course prevents “tag” editing in the app itself. You can drag PDFs from iTunes to iBooks and the name and artist/author tags will be copied to Title and Author correctly, but that’s insufficient for me. I prefer the bevy of tags available for PDF tracks in iTunes.

Deal-breaker for some: under Mavericks, with iBooks installed, PDFs added to iTunes are put in the Music library. Under earlier OS’s, iTunes puts them in Books or Audiobooks.

More information and download here.

November 6 '13 - 8:18 am
Add Files in Reverse, Sort by Date Added

A Correspondent writes that he sorts his Music library playlist by Date Added and meticulously adds each new album’s worth of files to iTunes in reverse order—one file at a time—so that an album will appear in order (well, the order established for them in the Finder); older tracks appear sorted lower in the Music library playlist than newer tracks. Get me?

Predictably, Our Correspondent is dismayed by the drudgery of this method and inquires if AppleScript can provide any relief. AppleScript provide relief from drudgery? Ahoy!

tell application “Finder”

set selectedFiles to selection

repeat with i from (length of selectedFiles) to 1 by -1

my addFile(item i of selectedFiles)

delay 1

end repeat

end tell

to addFile(aFile)

tell application “iTunes”


add aFile as alias

end try

end tell

end addFile

Save this as a Script Bundle—named whatever you like—to your ~/Library/Scripts/ folder. This will make the script available in the system-wide Scripts menu at the right side of the menu bar. Select the files in the Finder you want to add, which have been sorted in the order you want, and launch the script. It will add the files to iTunes in reverse order so that when they are sorted by Date Added in iTunes they appear in the order you had for them in the Finder.

UPDATE November 11, 2013: Added 1 second delay in repeat loop to prevent tracks from having the same date added (to the second) and sorting arbitrarily.

May 31 '13 - 12:41 pm
UPDATED: File Renamer v2.3

File Renamer will rename the files of the selected tracks (or the files of the tracks in the selected playlist) with a filename pattern that is formulated using the tracks’ tag data. Optionally, export a copy of the files to a chosen location and rename the files in that location.

This latest version will format date properties as YYYYMMDDHHMMSS.

More info and download here.

May 22 '13 - 6:20 pm
NEW: ConvExp to Album Folders

In my (seemingly never-ending) quest to get music into my car like a Regular Person I found that if I fill a USB stick with audio files in Artist/Album folders my car’s audio system will occasionally work right. The script Export to Album Folders does this. Then I realized that I had a lot of Apple Lossless files which I’d have to convert to MP3 before dumping them to the stick. But that leaves the superfluous converted tracks and their files in iTunes’ library which I’d have to remove using my hands.

ConvExp to Album Folders (Convert and Export to Album Folders) takes care of converting selected tracks, moving the converted files in Artist/Album folders to a selected location, and removing of the converted effluvia from iTunes.

A couple of Correspondents inquired about doing something like this, so I hope they and you find it useful.

More info and download here.

April 17 '13 - 12:08 pm
UPDATED: File Renamer v2.2

File Renamer will rename the files of the selected tracks (or the files of the tracks in the selected playlist) with a filename pattern that is formulated using the tracks’ tag data. Optionally, export a copy of the files to a chosen location and rename the files in that location.

This latest version fixes a problem with escaping file path delimiters, fixes an issue with closing the Preview window, and has other minor fixes and enhancements.

You can download it here.

April 10 '13 - 7:48 am
UPDATED: Export Selected With M3U v1.1

I’ve been wrestling with how to get files onto a USB stick for my car’s audio system for some time now. The system can read files on a stick and then sort them by Songs, Artist, Album, Genre, Folders, and Playlist; but unless the files are loaded just-so, playlists are empty, data goes missing, files can’t be played. I’ve also heard from Correspondents who report similar difficulties with their devices and it’s obvious that there is no single standard convention for file storage among the many types of media players out there. Some players can’t read subfolders, some require subfolders; some need everything in a “MUSIC” folder; some need specialized file-naming; and so on. (My car can also read the data from various generations of iPods and iPhones but, again, not consistently.)

Export Selected With M3U v1.1 will copy the files of the selected tracks to a user-chosen location—presumably some kind of portable media—and then create a M3U playlist file in the same location with relative file path references to the copied files.

The options available should be able to contend with any configuration required by any particular player. This latest version adds pattern-substitution file renaming and can optionally detect if the selected volume is FAT32 formatted which some players require.

More information, screenshot of results, and download is here.

March 14 '13 - 2:06 pm
UPDATED: File Renamer v2.0

Week or so ago this site got some hits from a post at Reddit which served to remind me that “Uh, this site’s been around for thirteen years.” One of the comments reported that “I used a file renamer script that renames files based on the tracks metadata. It changed all my .m4a tracks to .mp3 and broke a lot of my library even though I told it to not replace file extensions.” Sorry about that.

The original version of File Renamer (which was written by a fellow named Tino Heth) was posted in January 2002 and it hasn’t been updated since. Back then, there were only MP3s, so the script didn’t have to account for M4A. Unfortunately, it didn’t account for any other extensions either. So I thought if people are still talking about it after all these years I’d better update it.

You can download it here.

January 15 '13 - 1:54 pm
NEW: Export Selected With M3U

I’ve never had much use for M3U playlist files until we finally got a car (2011 Dodge Charger) with an audio system (so-called) that can accept a USB stick. Plus, over the years I’ve often been asked about getting iTunes files onto portable media (going back to the MiniDisc). So I whipped up this script, Export Selected With M3U, to export a selection or playlist of tracks’ files to a user-chosen location and then create an M3U playlist file referencing the tracks:

And because not every player can use this configuration, there’s also an option to place the audio files in a discrete subfolder.


June 20 '12 - 9:50 am
NEW: Convert and Replace

It hadn’t ever occurred to me that the term “convert”, as it applies to converting an audio file from one type to another and which is the AppleScript command for doing so, could be construed to mean “replace”. Though that’s probably why Apple has unambiguously named the menu item in the iTunes Advanced menu used to “convert” a track selection as “Create MP3 Version” (or whatever the current import setting is). It’s pretty obvious you get an additional new track and not a transformed replacement.

“Convert” in its “replace” sense, however, is what a number of Correspondents have wanted to do: downsize some ALAC tracks to AAC or MP3, for example, and have the converted versions replace the occurrences of the originals in any playlists.

Convert and Replace will convert a batch of selected tracks—or the tracks in a selected playlist—using an encoder chosen on-the-fly (the encoder’s current Preferences-set options will be applied) and replace the originals throughout your entire library with the converted versions. Additionally, you can opt to Trash/delete or keep the original files and tracks. (If the tracks are kept they remain in the “Music” library but will have been replaced in all other playlists.)

Possible deal-breaker: newly converted tracks will have a Date Added of “now”. There is no getting around this since Date Added is a read-only property assigned by iTunes when a new track is added to its library.

For OS X 10.6 or better.

Site contents © 2001 - 2015 (that's right: 2001) Doug Adams and weblished by Doug Adams, dougscripts AT mac DOT com. About.
All rights reserved. Legal.
AppleScript, iTunes, iPod, iPad, and iPhone are registered trademarks of Apple Inc. This site has no affiliation with Apple, Inc.