This script is great! I use it to fetch a couple of weekly mp3s from the BBC, and found that adding these lines to the end of the script meant I didn't end up with directories containing only empty m3u files: --cut here-- # Discard empty podcast files / data directories [ -s $datadir/podcast.m3u ] || rm $datadir/podcast.m3u rmdir $datadir 2>/dev/null --cut here-- There's probably a more elegant way to do this, but hey! It works :-)