#include <Array.au3>
#Include <File.au3>
Local $FileNumber = 0 ;记录数组维数,全局变量
Local $FileArray[1] ;返回的文件名主数组(全路径),全局变量
Local $result = "result.txt"
FindFiles("G:\photo", "*.jpg") ;这里改为你自己要遍历的文件夹
;$FileArray[0] = $FileNumber
;_ArrayDisplay($FileArray, "Pictures");调用“Array.au3”的子函数函数,显示整个数组信息
For $i = 1 To $FileNumber
FileWriteLine($result, $FileArray[$i])
Next
Func FindFiles($path,$filelx)
Local $filelist
Local $folders
Local $i,$j,$newpath
$filelist = _FileListToArray ($path,$filelx,1)
if not @error then
if $filelist[0]>0 Then
for $i=1 to $filelist[0]
$FileNumber = $FileNumber + 1
ReDim $FileArray[UBound($FileArray) + 1]
$FileArray[$FileNumber] = $path & "\" & $filelist[$i]
Next
EndIf
EndIf
$folders = _FileListToArray ($path,"*",2)
if Not @error Then
If $folders[0] > 0 Then
For $j=1 to $folders[0]
$newpath = $path & "\" & $folders[$j]
FindFiles($newpath,$filelx)
Next
EndIf
EndIf
EndFunc
-----------------------------------------------------------------
结果在脚本程序目录下的result.txt文件里。
联系客服