1
3
I have discovered an old playlist that I'd really like to listen to. Unfortunately, it's one that was created for a USB stick that had music copied out of my collection into a flat folder.
What I want to do now is recreate that playlist by matching those filenames to the paths in my main music collection.
As an example, suppose my existing playlist looks like this:
F:\music\Artist 1 - Song 1.mp3
F:\music\Artist 2 - Song 2.mp3
F:\music\Artist 3 - Song 3.mp3
And after processing, I might end up with something like this:
W:\Music Collection\Compilations\Compilations Forever 6\Artist 1 - Song 1.mp3
W:\Music Collection\Artist 2\This is the Album\Artist 2 - Song 2.mp3
W:\Music Collection\Unsorted New Stuff\Artist 3 - Song 3.mp3
The filenames are guaranteed to be the same, the paths will always be different.
There are about 300 tracks on this playlist, so it would be laborious to manually search for each one individually. I've had a look at XCOPY, having read about EXCLUDE, I was hoping there'd be an INCLUDE, but alas that wasn't going to be an option. I'd also read about using a FOR loop inside a batch file, but it's been a long time since I wrote batch files and I'm not quite sure where to begin.
Thanks very much for your help
1Absolutely beautiful and so fast. Interestingly your solution suffered from the same problem my regex did at first, which was that it would find files ending in a match - and I had a file called "03.mp3", of which there were a number "Artist - Live in 2003.mp3" would be a match for that. However, as you mentioned, it looks at the full path, so all I needed to do was add a slash at the beginning of each line of oldList.txt. Brilliant solution mate. – Iain Fraser – 2014-03-14T01:49:47.830
@IainFraser - Great idea to add the backslash before each file name in the search list. I've edited the answer. – dbenham – 2014-03-14T02:12:10.120