Been trying to find a solution to this one for ages. Turns out it's stupidly simple - just dump the results of a find into a file.
#!/bin/bash dir="$1" echo "Create playlist for $1 ..." if [[ $2 ]]; then list="$2"; else list="$1"; fi pushd "$dir" 2>&1 >/dev/null find . -type f -name "*.mp3" > "$list.m3u" echo "Found these files:" cat "$list.m3u" popd 2>&1 >/dev/null
With or without the "./" prefix on each found file, the resulting .m3u files work on my Blackberry (and are found automatically), including nested folders and paths with spaces. To run the above, just do this:
$ ./m3u.sh "artist folder/disc folder" "playlist name"