sshrum Posted August 29, 2006 Share Posted August 29, 2006 (edited) I'm using the _FileSearch function(and t works great for sub 1,000 file searches) I got from someone here and find that pulling this list takes FOREVER to poll a folder of 30,000+ files! A DOS dir /b /o command takes like 20-30 seconds. Is there a way to make the DOS dir call and harvest the output? TIA BTW: AutoIT really should have some sort of built-in higher level FileDir function (in addition to the filefind options) (IMHO) Edited August 29, 2006 by sshrum Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot' Link to comment Share on other sites More sharing options...
sshrum Posted August 29, 2006 Author Share Posted August 29, 2006 Opps...STDOUT. I should look first before I post. Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot' Link to comment Share on other sites More sharing options...
trids Posted August 29, 2006 Share Posted August 29, 2006 I haven't tried StdOut yet .. but you can also re-route the output of the DIR command to a file which you can then interrogate .. DIR /B/O>c:\Files.txt Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 29, 2006 Moderators Share Posted August 29, 2006 Are you using this one.. I use several different versions like this for different things because of the speed?http://www.autoitscript.com/forum/index.ph...c=16421&hl= 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. Link to comment Share on other sites More sharing options...
trids Posted August 29, 2006 Share Posted August 29, 2006 That kind of thing, yes The DOS DIR command is very useful (and fast) .. here are some more links..iterating subfolders for size .. or just for the filenames, a common requirement.ordered file list .. also easily switched to recusion with "/s" parameter Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 29, 2006 Moderators Share Posted August 29, 2006 Those are great (and old )!!! 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. Link to comment Share on other sites More sharing options...
trids Posted August 29, 2006 Share Posted August 29, 2006 LOL .. there are quite a few old things that are great The best part is that AU3 allows you to leverage all sorts of great things from outside too. Link to comment Share on other sites More sharing options...
sshrum Posted August 29, 2006 Author Share Posted August 29, 2006 This is what I came up with on my own last night. It's a ton faster then the old _FileSearch()! Uses STDOUT (no file writting/parsing like the other one you mentioned), took 14 seconds to return a listing of ~19,000 files versus ~3+ minutes the old way. This can be used to replace your _FileSearch() and _FileSearchUtil(). Uses the same function syntax. Func _FileSearch($sQuery, $bSubdir=0) $iLine = 0 $sLine = "" $aLine = "" Dim $aFiles[100000];just a big number, we'll redim later $sArguments = "/a-d /b /on";filenames, not folders If $bSubdir = 1 Then $sArguments = $sArguments & " /s" $aRaw = Run(@ComSpec & " /c dir " & $sQuery & " " & $sArguments, @SystemDir, @SW_HIDE, 2) While 1 $sLine = StdoutRead($aRaw) If @error Then ExitLoop $aLine = StringSplit($SLine, @CRLF) If $aLine[0] > 1 Then For $i = 1 To $aLine[0] If $aLine[$i] = "" Then Continueloop $iLine = $iLine + 1 $aFiles[$iLine] = $aLine[$i] Next Else $iLine = $iLine + 1 $aFiles[$iLine] = $sLine EndIf Wend $aFiles[0] = $iLine ReDim $aFiles[$iLine + 1] Return $aFiles EndFunc Work's for me! Enjoy! Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot' Link to comment Share on other sites More sharing options...
Valuater Posted August 29, 2006 Share Posted August 29, 2006 did you try this one... filelisttoarray() #Include <File.au3> #Include <Array.au3> $FileList=_FileListToArray(@DesktopDir, 1) If (Not IsArray($FileList)) and (@Error=1) Then MsgBox (0,"","No Files\Folders Found.") Exit EndIf _ArrayDisplay($FileList,"$FileList") 8) Link to comment Share on other sites More sharing options...
Valuater Posted August 29, 2006 Share Posted August 29, 2006 (edited) actually, this uses both dir in dos and filelisttoarrayadvanced file managerhttp://www.autoitscript.com/forum/index.ph...=20459&hl=#8) Edited August 29, 2006 by Valuater Link to comment Share on other sites More sharing options...
sshrum Posted August 29, 2006 Author Share Posted August 29, 2006 No...I didn't know about that! Was just starting to create a File UDF too. Gunna check it out now! Thanx Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot' Link to comment Share on other sites More sharing options...
sshrum Posted August 29, 2006 Author Share Posted August 29, 2006 (edited) Hey valuater...I noticed that the STDOUT in AutoIT munges accented characters (I have another thread on this). I'll assume the FileListToArray will do the same thing as it uses the same sort of call. Any way to correct this? Edited August 29, 2006 by sshrum Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot' Link to comment Share on other sites More sharing options...
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