Help with creating multiple m3u playlists from folders in SD Card.

Hi all, I was hoping someone could help with the below.

I have an SD card full of music that’s set up as Artist>Album>Songs

Does anyone know how to write a script that will automatically create a m3u playlist of ALL the song in each Artist folder. Ultimately I just want to have one individual playlist that includes all of an artists songs/albums in one. For example Artist 1 would include have one playlist that includes all the songs in each of the 3 albums on the SD Card. Preferably, I’d like to save all of the playlists in the main directory on the SD card so I can easily pull them up in my car.

For what it’s worth, the reason I want to do this is the music interface in my car reads each individual folder…so if I want to list to random songs by each artists from random albums I can’t…since they’re split up into subfolders like I mentioned above.

Hi. This creates a workable playlist that iTunes can use. In theory, it should also work with your car’s proprietary system.

set tracks to (do shell script "find " & ((choose folder)'s POSIX path)'s quoted form & " -name '*.mp3' -or -name '*.m4a' -type f")
tell application "Finder" to write "#EXTM3U" & return & tracks to ((make file with properties {name:"whatever.m3u"}) as alias)

Thanks for your help!

I actually found another workaround after doing some digging. This is a shell script I found…if I run it as a service it does exactly what I needed it to do. The only problem I’m having is that I can’t seem to map this to a keyboard shortcut…I have to manually select it from the service dropdown every time i want to run it.

Shell: /bin/bash
pass input: as arguments

for dir; do cd “$dir” && find . -type f ( -name ‘.mp3’ -o -name '.aac’ -o -name ‘.m4a’ -o -name '.wav’ -o -name ‘.wma’ ) -exec bash -c 'file=“{}”; printf “%s\n” "${PWD##/}/${file#/}" >> "…/${PWD##/}.m3u"’ ;; done