I’ve been banging my head against the wall on account of different music
players which can’t play the subset of songs I have encoded as either
Vorbis or AAC. So I’m slowly converting my entire music library over to
MP3, which works everywhere, even if it’s less efficient.
But before I go digging through my old CDs I need to identify which
albums I have to re-encode. My music is organized in folders by artist
and then album, e.g.:
~\Music\Library\Pixies\Surfer Rosa\Where Is My Mind.mp3
So this means I effectively have to list the names of folders containing
non-MP3 music files. Fortunately Windows PowerShell makes this a
one-liner (though admittedly it’s a pretty long line; the backtick is
PowerShell’s line continuation syntax):
ls -r Music\Library `
| ?{ $_.PSIsContainer -And ( $_.GetFiles() `
| ?{ $_.Name -Match "\.(m4[ap]|ogg|wma)$" } ) } `
| %{ New-Object PSObject -Property `
@{ Artist = (gi $_.PSParentPath).Name; Album = $_.Name } }
This will give you a nice list of non-MP3 albums, like:
Album Artist
----- ------
That's Your Fire Aloha
Noble Beast Andrew Bird
Believe It Mammals Bats & Mice
Charm School Bishop Allen
[...]
And thanks to PowerShell’s object-oriented pipes, this …
Read more…