Tuesday, 15 December 2015

How To Create A Playlist Of All The Music Files On Your Computer (Windows)

I download music from here and there and copy files to different folders. So, sometimes I have no idea where my music files are and want to play all of them or make them into a huge playlist. So, I decided to find a way to create a solution and did some research. I found a file searching method using command prompt and modified it a bit to create this solution. Today, I'm going to show you how to make a playlist out of the music files stored on different drives on your computer.  For this, I'm going to write a DOS batch file. You can type the commands on command prompt or make a batch file and run it to get the same result.

First, we need the file extensions for music - mp3, aac, m4a are some music file extensions. I'm going to use these three extensions here. Playlists come in the extension .m3u and .wpl (in the case of windows media player.)

Now, copy the below code into notepad and save as .bat file.

@echo off
for %%a in (c d e f g h i j k l) do if exist "%%a:\" dir /b /s /a-d "%%a:\*.m4a" "%%a:\*.mp3" "%%a:\*.aac" >>"D:\playlistall.m3u"

Now, double click the bat file to run it. This will generate a playlist with .m3u extension, on D drive in this case (you can change it to your preferred drive or location). The newly generated playlist can be opened in KM Player or VLC Media Player. It will contain all the music files on your computer having the formats given in bold.

If you want to create a windows media player playist, use the same code, except change the .m3u to .wpl 

Now if you just want to find out where each music files are, ie, with the folder address, use .txt in place of .m3u It will generate a text file which contains the file location of each of the music files as show below.

You can use this method to find location of other types of files too, like movies or pdf files, by changing the file extensions to search for..

P.S I tried it on Windows 7 and Windows 10. Currently, it searches all the files without considering the file size. I don't really know how to add the file size filtering into this code. If you know it, please comment below. I will add it and update the blog. Thank you!

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...