#!/bin/bash m3u="${1##*/%%/}.m3u" LONG="${1##*/}" SHORT="${1%%$LONG}" echo "Path= $1" echo "Long= $LONG" echo "Short= $SHORT" echo "m3u= $m3u" for x in "$1"/*/*.mp3; do echo "$x"; done #for x in $1/*.mp3; do echo "$1$x"; done #for x in $1/*/*.mp3; do echo "$x" >> "${1##*/}.m3u"; done