I am trying to create a shell script in Linux that, when executed, looks for a directory for all media files, then creates a playlist and plays it back using MPlayer.
Use this command:
find /PATH/TO/MUSIC/DIRECTORY/ -type f -iname "*.mp3" > playlist.m3u
Now play with mplayer:
mplayer -playlist playlist.m3u