#!/usr/bin/env python import commands, os from random import * cmd = "find /export/home/music -type d" dirs = commands.getoutput(cmd).split("\n") shuffle(dirs) f = open("/usr/local/etc/ices-playlist.txt", "w") for dir in dirs: cmd = "find '%s' -maxdepth 1 -type f -name '*.mp3' -print | sort" %dir output = commands.getoutput(cmd) #print output f.write(output) f.write("\n") f.close() os.system("sed -i '/^$/d' /usr/local/etc/ices-playlist.txt") #os.system("kill -s SIGUSR1 `cat /var/log/icecast/ices.pid`")