Over the holidays, I bought a Sansa c250 mp3 player, a) because it was cheap and b) because it contains a microSD card expansion slot, which, in theory, would allow me to expand the disk capacity indefinitely.
Before I learned how to upgrade the firmware on the player, I was relegated to using software like Windows Media Player to move MP3s onto the device—a pox on all devices that force you to use special software to move files onto them (like this dumb digital ornament I bought for my dad—sorry, Dad). At any rate, I wanted to begin using the device and learn how to use the expansion slot later, so I built up a playlist of tons of my favorite podcasts. Since the player’s disk was only 2gb, though, I had to be careful not to pack too many files into the playlist. So my question, how do I know the sum total of all the files I’m trying to sync to the player?
Windows Media Player will tell you the total number of files you have in your playlist, it’ll even tell you the total number of hours and minutes your playlist represents, but as far as I can tell it won’t tell you total size of the files represented by the playlist (even though the Library tab will tell you the size of each individual file).
Fooey on that. PowerShell can tell me the answer. I wrote this script to calculate the total size of the files:
| $playlistName = "C:\Documents and Settings\Administrator\My Documents\My Music\My Playlists\talk.wpl" $playlist = [xml](cat $playlistName) $totalSize = 0 $files = $playlist.smil.getElementsByTagName("media") foreach($file in $files) { if(test-path $file.getAttribute("src")) { $totalSize += (get-item $file.getAttribute("src")).length/1Mb } } "The total size of " + [io.path]::GetFileName($playlistName) + " is: " + $totalSize + " Mb" |
The script produced the following results:
So it looks like my playlist will fit nicely on my 2gb player. Problem solved.