How can I create a list of all my music?

· Windows Scripts

I’ve got all my music organized into folders by artist or band name. One fear is that I’ll lose all my music and then I’ll forget certain songs and artists and never hear them again. No, it’s not the end of the world, but I’d rather be prepared.

If you’re not afraid of the command line, there is an easy little command you can run that will grab all your song file names and store them in a file.

Say I’ve got all my music stored here: C:\Users\Joe\Desktop\Music

Open up Command Prompt and type in: cd C:\Users\Joe\Desktop\Music

Press Enter. You should now see this: C:\Users\Joe\Desktop\Music>

The command, cd, changes to specified directory. Now that you are in the root of your music directory, run this command: dir /b /s > musiclist.txt

If you open up the Music folder, you should see a text document with full file paths that looks similar to this:

C:\Users\Joe\Desktop\Music\Beach Boys  
C:\Users\Joe\Desktop\Music\Elvis Presley  
C:\Users\Joe\Desktop\Music\musiclist.txt  
C:\Users\Joe\Desktop\Music\The Beatles  
C:\Users\Joe\Desktop\Music\Beach Boys\Little Deuce Coupe.mp3  
C:\Users\Joe\Desktop\Music\Beach Boys\Surfin USA.mp3  
C:\Users\Joe\Desktop\Music\Elvis Presley\Jailhouse Rock.mp3  
C:\Users\Joe\Desktop\Music\Elvis Presley\King Creole.mp3
C:\Users\Joe\Desktop\Music\The Beatles\All My Loving.mp3
C:\Users\Joe\Desktop\Music\The Beatles\Yesterday.mp3

Pretty gross, huh? I’ll call this the raw data. Let us beautify the data into something presentable. I’ve got 3 folders in the Music folder:

  • Beach Boys
  • Elvis Presley
  • The Beatles

Each folder has two amazing songs in it (up for debate, of course). If I’ve only got 6 music files, I should only have 6 lines in that file. To manipulate the data, all you need is a simple text editor like Notepad. Let’s do a quick Replace operation.

  • Find: C:\Users\Joe\Desktop\Music
  • Replace with: (leave this blank)

Now the file looks like this:

Beach Boys  
Elvis Presley  
musiclist.txt  
The Beatles  
Beach Boys\Little Deuce Coupe.mp3  
Beach Boys\Surfin USA.mp3  
Elvis Presley\Jailhouse Rock.mp3  
Elvis Presley\King Creole.mp3  
The Beatles\All My Loving.mp3
The Beatles\Yesterday.mp3

Much better, but there is still some extra stuff in there we don’t need. Remove the first 4 lines which are all just artist names and the file itself. Now you’ll have this:

Beach Boys\Little Deuce Coupe.mp3  
Beach Boys\Surfin USA.mp3  
Elvis Presley\Jailhouse Rock.mp3  
Elvis Presley\King Creole.mp3  
The Beatles\All My Loving.mp3
The Beatles\Yesterday.mp3

A few more Replace operations will make this look even better.

  • Find: .mp3
  • Replace with: (leave this blank)

Now each line is in the format: Artist Name\Song Name

Beach Boys\Little Deuce Coupe  
Beach Boys\Surfin USA  
Elvis Presley\Jailhouse Rock  
Elvis Presley\King Creole  
The Beatles\All My Loving
The Beatles\Yesterday

You can even do another Replace operation and change the backslashes to tabs or commas (be careful of names that already have a comma in them). Once you get it in a format you like, you can email, upload, share, or import into Excel.

author image

About Joseph Spurrier

I'm passionate about building solutions to automate tasks and improve efficiency. I worked for a few companies in the digital healthcare space. My education is in forensics. Tech guy. Traveler. Runner. Guitar player. Scotch and beer enthusiast. GitHub LinkedIn Twitter Google+

Share this post


Comments powered by Disqus