Batch m3u playlist creation for all folders, with the playlist named like the folder |
Batch m3u playlist creation for all folders, with the playlist named like the folder |
Jul 3 2006, 19:54
Post
#1
|
|
|
Group: Members Posts: 22 Joined: 30-April 05 Member No.: 21806 |
I've been trying to find an easy way to do this, but I can't seem to find exactly what I need. I just want a simple way to:
Any help is appreciated. |
|
|
|
![]() |
Jul 3 2006, 22:05
Post
#2
|
|
![]() Group: Members Posts: 15 Joined: 10-May 02 Member No.: 2014 |
I've been trying to find an easy way to do this, but I can't seem to find exactly what I need. I just want a simple way to:
This script should sort you out: CODE Const ForReading = 1, ForWriting = 2, ForAppending = 8 delete = false set args = WScript.Arguments if args.Count > 0 then if LCase(args(0)) = "-d" then delete = true end if end if set fso = createobject("scripting.filesystemobject") wscript.echo WriteM3u(fso.GetAbsolutePathName("."), delete) & " files written" function WriteM3u(path, delete) dim count set fso = createobject("scripting.filesystemobject") set fdr = fso.GetFolder(path) if fdr.SubFolders.Count = 0 then m3u = path & "\" & fdr.name & ".m3u" if fso.FileExists(m3u) then if delete then wscript.echo "... deleting existing file" fso.DeleteFile m3u else wscript.echo "... renaming existing file" fso.MoveFile m3u, m3u & ".old" end if end if wscript.echo "... writing """ & fdr.name & ".m3u""" set m3ufile = fso.OpenTextFile(m3u, ForWriting, True) for each f in fdr.Files if right(f.Name, 3) = "mp3" or right(f.Name, 3) = "ogg" then m3ufile.WriteLine(f.Name) end if next m3ufile.Close count = 1 else count = 0 for each subfolder in fdr.subfolders wscript.echo "Searching """ & subfolder.path & """" count = count + WriteM3u(subfolder.path, delete) next end if WriteM3u = count end function Just save it to "WriteM3u.vbs" and stick it in the root directory of your mp3 and ogg files. To run, type: CODE cscript WriteM3u.vbs By default it will rename any existing m3u files it finds. If you would rather delete them, just add "-d" to the end of the command-line, i.e. CODE cscript WriteM3u.vbs -d -Paul |
|
|
|
Jul 4 2006, 01:14
Post
#3
|
|
|
Group: Members Posts: 53 Joined: 26-July 05 Member No.: 23534 |
Thank you Paul, this is a nice and useful script
|
|
|
|
Jul 4 2006, 21:08
Post
#4
|
|
![]() Group: Members Posts: 15 Joined: 10-May 02 Member No.: 2014 |
|
|
|
|
zambaretzu Batch m3u playlist creation for all folders Jul 3 2006, 19:54
carmik TAG can also do this from the command line. I use ... Jul 4 2006, 00:04
zambaretzu Yeah, thanks, it's awesome. If you wrote it yo... Jul 5 2006, 22:51
masterofimages QUOTE (zambaretzu @ Jul 5 2006, 22:51) Ye... Jul 6 2006, 18:04
zambaretzu Thanks a lot masterofimages.
There's still a... Jul 6 2006, 20:49
masterofimages QUOTE (zambaretzu @ Jul 6 2006, 20:49) Th... Jul 7 2006, 01:22
zambaretzu Thank you, thank you! Jul 12 2006, 01:00
Tbenhov Thanks for the great script!! Is it possib... Jul 24 2006, 14:26
JustATechFan I had been looking for an automated way to create ... Jan 5 2013, 15:52
ramalina It would be perfect if the files were order by nam... Jan 27 2013, 11:53![]() ![]() |
|
Lo-Fi Version | Time is now: 19th May 2013 - 06:56 |