Batch rename with powershell running multiple times with one command

jfreund

[H]ard|Gawd
Joined
Sep 3, 2006
Messages
1,637
I got a vehicle that already has a decent head unit, so I kept it and upgraded amps and speakers. The problem with the head unit is it only recognizes 255 folders on a USB stick. The USB stick I use for my music has 800+ folders; one for each artist, then inside that one for each album by that artist. I'm appending the year and album name to the filenames so I can just put all the files into the artist folder.

I've been using powershell and it works, kind of. It adds the year and album name to each file, but it keeps adding it 2 and 3 times. Here's the command I'm using:

dir | rename-item -newname {"YEAR Album Name " +$_.name}

And I keep getting "YEAR Album Name YEAR Album Name 01 Track Name.mp3" or "YEAR Album Name YEAR Album Name YEAR Album Name 02 Track Name.mp3". Then I have to delete the multiple entries, which defeats the point of using batch rename in powershell.

Is there a way to make it add the text to each filename only once?
 
Back
Top