Skip navigation

Q: How do I copy all the files in an Apple iTunes playlist to another location?

A: After I created the script to take the media files from a Windows Media Player playlist, I did the same for Apple iTunes.

First, you need to export the iTunes playlist to M3U format. Right-click the playlist in iTunes, select Export from the context menu, select the m3u type, and enter a name.

After the playlist is exported, feed it into the script below:

# copyWPL.ps1
write-host "Searching file "$args[0]" for media files and sending to "$args[1]"`n"

$textFile = Get-Content $args[0]

$dest = $args[1]
if (!$dest.EndsWith("\")) #if no ending slash we need to add it
{ $dest = $dest + "\"}

foreach ($textLine in $textFile) 
{
    if(!$textLine.StartsWith("#EXT"))
    {
        write-host "Copying file $textLine"
        Copy-Item $textLine $dest
    }
}

write-host "`nCompeted Copy`n"

Below is the script in action (again, no comments on music taste):
PS D:\temp> .\parseM3U.ps1 Favorites.m3u d:\temp\mp3
Searching file Favorites.m3u for media files and sending to d:\temp\mp3

Copying file D:\Multimedia\Music\Sara Bareilles\Kaleidoscope Heart\12 - Breathe Again.mp3
Copying file D:\Multimedia\Music\Rock Mafia\The Big Bang\01 - The Big Bang.mp3
Copying file D:\Multimedia\Music\Britney Spears\Till The World Ends\01 - Till The World Ends.mp3
Copying file D:\Multimedia\Music\Darude\Sandstorm\01 - Sandstorm (Radio Edit).mp3
Copying file D:\Multimedia\Music\Dido\No Angel\08 - Slide.mp3

Competed Copy
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish