#!/usr/bin/env python # -*- coding: utf-8 -*- import os, random from pprint import pprint ext = ".mp3" r = random.Random() r.seed() current_path=os.getcwd() for root,dirs,files in os.walk(current_path): r.shuffle(files) print "cd \"%s\"" % root num = 0 for filename in filter(lambda x: x.lower().endswith(ext), files): num+=1 print "ren \"%s\" \"%03d_%s\"" % (filename, num, filename)