#!/usr/local/bin/bash # UPDATED BY : operat0r support sed 's/ /%20/g' to remove spaces and replace them with %20 # http://rmccurdy.no-ip.com/ # Greg Oldendick # m3u_script # Sept 1, 2002 # warning, this script uses rm -f =) # # This script creates playlist.m3u files for each subdirectory containing mp3 # files. It uses recursion, which probably explains the relatively slow speed. # (i.e. bash recursion isn't the greatest =) # Note it does not work on .MP3 files, only .mp3. This is intentional. if [[ "$1" == "" ]] then echo Usage ./makem3u "http://hostpath/mp3" sleep 5 fi rm playlist.m3u export varfile=$1 #recursive function go_deeper() { for file in * # for each file (and subdirectory) in the current directory do if [ -d "$file" ] # if $file is a directory then cd "$file" echo `pwd` # print rm -f playlist.m3u # if we already have a playlist file, rm it go_deeper cd .. else if [ `echo "$file" | rev | cut -c 1-4` = 3pm. ] # if $file is an mp3 then echo $varfile $file >> playlist.m3u fi fi done } # Main function =) go_deeper cat playlist.m3u | sed 's/ /%20/g' > tmp mv tmp playlist.m3u cat playlist.m3u exit 0