Sign in to follow this  
Followers 0
Stuperman

Song List

11 posts in this topic

#include <file.au3>

; Shows the filenames of all files in the current directory

$search = FileFindFirstFile("*.mp3")

; Check if the search was successful

If $search = -1 Then

MsgBox(0, "Error", "No files/directories matched the search pattern")

Exit

EndIf

While 1

$file = FileFindNextFile($search)

If @error Then ExitLoop

_FileWriteLog(@ScriptDir & "\songlist.log",$file)

WEnd

; Close the search handle

FileClose($search)

This is the code I have so far. I just need to figure out how to search in all subdirectories as well. Any help again would be awesome.

Share this post


Link to post
Share on other sites



Do a search on the forum for "Recursive file search" and you should come up with some options.


Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Share this post


Link to post
Share on other sites

Forgive me, I am a little new and learning at a slow pace. Could someone possibly show me how I would incorporate that to just create a list of songs in all folders and subfolders. Thanks

Share this post


Link to post
Share on other sites

Forgive me, I am a little new and learning at a slow pace. Could someone possibly show me how I would incorporate that to just create a list of songs in all folders and subfolders. Thanks

#include <array.au3>

;Search for mp3 files recursively

$Array = RecursiveFileSearch(@DesktopDir & "\New Folder", "(?i)\.(mp3)", true)

_ArrayDisplay($Array)

Share this post


Link to post
Share on other sites

Another easier way, if dumping all mp3s to a log file is all you want to do:

Run(@ComSpec & " /c dir /s /b *.mp3 >> songlist.log","C:\",@SW_HIDE)

Share this post


Link to post
Share on other sites

Thank you very much covaks. That worked perfectly. If anything, is there also a way to get that to tell me the number of songs in said directories as well?

Share this post


Link to post
Share on other sites

If you want the total number of songs, try this. It will append the count to the end of the file. (You can append the count to the top of the file too if you play around a bit. )

#include <File.au3>

RunWait(@ComSpec & " /c dir /s /b *.mp3 >> songlist.log","C:\",@SW_HIDE)
$File = FileOpen("C:\songlist.log",1)
FileWriteLine($File, "Total number of songs: " & _FileCountLines("C:\songlist.log"))
FileClose($File)

Share this post


Link to post
Share on other sites

I also am curious, how can I make this work if I store songs on the F drive for instance?

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I also am curious, how can I make this work if I store songs on the F drive for instance?

Anywhere you see C:, change to F:

Edited by weaponx

Share this post


Link to post
Share on other sites

Could Something like this be used to get a list of songs off of my server?? I want to make a flash player that uses URL's from my server but I have like 100+ songs and dont want to click on everyone and copy their names and then past into the players code. Can this be used on a server?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0