In my search of filelist function, I read the File.au3 UDF to see how _FileListToArray was writing.
And in the code I saw that it work directly with array.
I noticed that this approach is slower than using strings and create the array in the end.
So, this is what I noticed on my laptop IBM R60 :
If I use standard _FileListToArray function, the time to do the trip on my @SystemDir is about : 49ms
If I modify the function to use strings, the time decreases to 32ms.
Well, 17ms isn't a long time, but my @SystemDir contains only 2497 elements.
For information, I make a test on my @WindowsDir (211 elements), and the difference between time is only of 1ms.
I don't know if it's a good idea to make the modification, but I put it here in case of.
Func _FileListToArray($sPath, $sFilter = "*", $iFlag = 0) Local $hSearch, $sFile, $sFileList, $asFileList[1] If Not FileExists($sPath) Then Return SetError(1, 1, "") If (StringInStr($sFilter, "\")) Or (StringInStr($sFilter, "/")) Or (StringInStr($sFilter, ":")) Or (StringInStr($sFilter, ">")) Or (StringInStr($sFilter, "<")) Or (StringInStr($sFilter, "|")) Or (StringStripWS($sFilter, 8) = "") Then Return SetError(2, 2, "") If Not ($iFlag = 0 Or $iFlag = 1 Or $iFlag = 2) Then Return SetError(3, 3, "") If (StringMid($sPath, StringLen($sPath), 1) = "\") Then $sPath = StringTrimRight($sPath, 1); needed for Win98 for x:\ root dir $hSearch = FileFindFirstFile($sPath & "\" & $sFilter) If $hSearch = -1 Then Return SetError(4, 4, "") While 1 $sFile = FileFindNextFile($hSearch) If @error Then SetError(0) ExitLoop EndIf If $iFlag = 1 And StringInStr(FileGetAttrib($sPath & "\" & $sFile), "D") <> 0 Then ContinueLoop If $iFlag = 2 And StringInStr(FileGetAttrib($sPath & "\" & $sFile), "D") = 0 Then ContinueLoop $sFileList &= $sFile & "|" WEnd FileClose($hSearch) $asFileList = StringSplit(StringTrimRight($sFileList, 1), "|") Return $asFileList EndFunc ;==>_FileListToArray






