#!/bin/sh
#The script is used for create lists for mp3 songs.
#Each directory has its own mp3 songs list.
#Author: Binglin Yang
#Date: 11/10/2005
#set the primary directory
THEPRIMARYDIR=$PWD
createList()
{
for dirName in *
do
if [ -d $dirName ]
then
cd $dirName
createList
ls *.[Mm][Pp]3 > /tmp/mp3Index.$$ 2>/dev/null
if [ -s /tmp/mp3Index.$$ ]
then
echo "Now creating the songs.m3u for music directory $PWD"
ls *.[Mm][Pp]3 > songs.m3u
# cat songs.m3u >> $THEPRIMARYDIR/All_songs.txt
cd ..
else
cd ..
fi
fi
done
}
createList
ls *.[Mm][Pp]3 > "/tmp/mp3Index.$$" 2> /dev/null
if [ -s "/tmp/mp3Index.$$" ]
then
echo "Now creating the songs.m3u for music directory $PWD"
ls *.[Mm][Pp]3 > songs.m3u
# cat songs.txt > $THEPRIMARYDIR/All_songs.txt
fi
rm -f "/tmp/mp3Index.$$"