BananaFredSoft Posted August 9, 2007 Posted August 9, 2007 I have been trying to make a function that finds all of the wav/mp3 files in a directory, even in the subdirectories and then indexes them. Here is my failed attempt: Func IndexDirectory () $rootdir = FileSelectFolder("Select the directory to index.", "") $dir = $rootdir & "\" $ff = FileFindFirstFile($dir & "*") While 1 $nd = FileFindNextFile($ff) If @error Then $dir = getdir($dir) If $dir = getdir($rootdir) Then ExitLoop ElseIf BitOR(StringRight($nd, 3) = "mp3", StringRight($nd, 3) = "wav") Then IndexFile($dir & $nd) ElseIf StringInStr(FileGetAttrib($dir & $nd), "D") Then $dir = $dir & $nd $ff = FileFindFirstFile($dir & "*") EndIf WEnd EndFunc Func IndexFile ($file) MsgBox(0, "Debug", $file) EndFunc Func getdir($filename) $split = StringSplit($filename, "\") If Not @error Then $dir = "" $num = 1 Do $dir &= $split[$num] & "\" $num += 1 Until $num = $split[0] Return $dir EndIf EndFunc ;==>getdir Can anyone help make this work? Thanks in advance -ColinSite:www.bananafredsoft.comStuff:Simple Text Editor - MediaPlayer - Animator - BananaDB - BananaNotes - Chatta - Filesearch - Excuse GeneratorMy YouTube channel:http://www.youtube.com/user/colipat
Moderators SmOke_N Posted August 9, 2007 Moderators Posted August 9, 2007 Look in randallc's signature for FileListToArray .... You can also look for _FileListToArrayEx() which I wrote in the examples forum, but I believe Randall's is now faster. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
BananaFredSoft Posted August 9, 2007 Author Posted August 9, 2007 Look in randallc's signature for FileListToArray .... You can also look for _FileListToArrayEx() which I wrote in the examples forum, but I believe Randall's is now faster.Does it get files in subdirectories? -ColinSite:www.bananafredsoft.comStuff:Simple Text Editor - MediaPlayer - Animator - BananaDB - BananaNotes - Chatta - Filesearch - Excuse GeneratorMy YouTube channel:http://www.youtube.com/user/colipat
BananaFredSoft Posted August 9, 2007 Author Posted August 9, 2007 (edited) I still can't figure out how to make a function that utilizes this and gets all of the .mp3/.wavs in subdirectories. Edited August 9, 2007 by BananaFredSoft -ColinSite:www.bananafredsoft.comStuff:Simple Text Editor - MediaPlayer - Animator - BananaDB - BananaNotes - Chatta - Filesearch - Excuse GeneratorMy YouTube channel:http://www.youtube.com/user/colipat
Moderators SmOke_N Posted August 9, 2007 Moderators Posted August 9, 2007 I still can't figure out how to make a function that utilizes this and gets all of the .mp3/.wavs in subdirectories.Did you bother to look up the 2 functions I told you to find? They both have the option to look for "specific extensions"/with Recurse. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now