改造下_FileListToArray函数,未作测试。
#Include <Array.au3>
$p=__FileListToArray("E:\UNZIPPED\IconImage" ,"*",1,1)
_ArrayDisplay($p)
Func __FileListToArray($sPath, $sFilter = "*", $iFlag = 0,$sort=1);前3个参数同_FileListToArray,$sort=1,升序;$sort=0,降序
Local $hSearch, $sFile, $sFileList, $sDelim = "|"
Local $path[1][2]
$sPath = StringRegExpReplace($sPath, "[\\/]+\z", "") & "\" ; ensure single trailing backslash
If Not FileExists($sPath) Then Return SetError(1, 1, "")
If StringRegExp($sFilter, "[\\/:><\|]|(?s)\A\s*\z") Then Return SetError(2, 2, "")
If Not ($iFlag = 0 Or $iFlag = 1 Or $iFlag = 2) Then Return SetError(3, 3, "")
$hSearch = FileFindFirstFile($sPath & $sFilter)
If @error Then Return SetError(4, 4, "")
While 1
$sFile = FileFindNextFile($hSearch)
If @error Then ExitLoop
If ($iFlag + @extended = 2) Then ContinueLoop
ReDim $path[UBound($path)+1][2]
$path[UBound($path)-1][0]=$sPath&$sFile
$path[UBound($path)-1][1]=FileGetTime($path[UBound($path)-1][0],0,1)
WEnd
FileClose($hSearch)
_ArraySort($path,0,0,0,$sort)
Local $array[UBound($path)]
For $i=0 To UBound($path)-1
$array[$i]=$path[$i][0]
Next
Return $array
EndFunc;==>_FileListToArray
|