Create m3u playlists from the command line on Mac OS x

This will create a m3u playlist in each sub-folder under the folder you are currently at. The m3u list wil be in the same order as if you did a ls command. You may want to adjust filenames so that playlist is generated in the order that you want rather than what ls outputs

find . -name ‘*.mp3’ -execdir bash -c ‘file=”{}”; printf “%s\n” “${file##*/}” >> “${PWD##*/}.m3u”‘ \;

About Jon Giffard

Husband, father, motorcyclist , amateur runner ( on hold due to knee injury ) - now trying not to drown whilst swimming. Product Manager at Webroot Not available for yodelling. Please do not ask.
This entry was posted in Apple Mac and tagged , , . Bookmark the permalink.

5 Responses to Create m3u playlists from the command line on Mac OS x

  1. Great. Works perfectly! Many thanks.

  2. Trav Fryer says:

    I wish this worked. I get a “find: -execdir: no terminating “;” or “+”” error. It generates an m3u but with parenthesis on either end plus an extra paren at the end, like “directoryname.m3u”‘. Also that file contains this (minus the external-most quotes) “““”n”“;n””

    Thoughts? :/ thanks!!

  3. Ron Story says:

    Thanks for this. I changed .mp3 to .flac (all of my files are FLAC). It worked great and the m3u works in Coppertino’s VOX.

  4. john hakkennes says:

    I came up with the following which will generate a playlist.m3u of all mp3 (MP3) files in the ‘username’/Music folder and place it on the Desktop.

    find / -iname *mp3 2>/dev/null | grep $USER/Music >> ~/Desktop/playlist.m3u

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s