Powershell Ripped Media Renaming Script
I recently bought a book on CD and ripped it to .wma so that I could listen to it on my portable media player. When the tracks rip to disk they get named with the track number starting first. I wanted to rename the files so that the two digit disc number preceded the track number so that I could sort all of the tracks in one folder and listen to them in the correct order. Here's a Powershell script that I ran from the folder one below the ripped discs' folders.
$disk = "01."
$dirr = "The Book Name Disc 1"
cd $dirr
$dir = get-childitem *.wma
foreach($x in $dir)
{
$newname = $disk + $x.Name.SubString(0,2) + ".wma"
Rename-Item $x $newname
}
cd ..
One limitation of the script is that I had to change the numeric values in the first two lines for each disk. I know that I can automate this use a range of numbers like I demonstrated in an earlier blog post. However, I couldn't quickly work out how to do this and was tired at the time and just wanted to get this done quickly. This little helper script is work-in-progress and the next time I need to use it I'll improve on it and edit it here.