HOla SI deseas hacer recursivo el programa para que se vaya desplazando por los subdirectorios, como opción, tienes aquí una función con un ejemplo:
Func _FileListToArray_Recursive($sPath, $sFilter = "*", $iRetItemType = 0, $iRetPathType = 0, $bRecursive = False)
Es un script con pocas lineas que te hace un listado de los ficheros, (pensado también para música, mp3..)
Código: Seleccionar todo
#include <File.au3>
#include <GUIConstants.au3>
#include <Array.au3>
Global $temppath = @ScriptDir
GUICreate("Inventory", 320, 265, -1, @DesktopHeight/10)
GUICtrlCreateLabel("Inventory v1.03 - Created by Rogue5099", 42, 5, 375, 20)
$Button_1 = GUICtrlCreateButton("Take Invenotry", 200, 34, 100, 50)
$Checkbox_1 = GUICtrlCreateCheckbox("Include Subfolders", 10, 30)
$Checkbox_2 = GUICtrlCreateCheckbox("Include Full File Path", 10, 55)
GUICtrlCreateLabel("File type to search for. i.e. .jpg,.mp3 (Seperate /w Comma):", 8, 97, 325, 20)
Global $Input3 = GUICtrlCreateInput("*.*", 25, 117, 240, 20)
GUICtrlCreateLabel("Save Inventory File to:", 8, 147, 125, 20)
Global $Input1 = GUICtrlCreateInput(@ScriptDir, 25, 167, 240, 20)
$Browse_1 = GUICtrlCreateButton("...", 270, 167, 30, 20)
GUICtrlCreateLabel("Scan directory for file(s):", 8, 197, 125, 20)
Global $Input2 = GUICtrlCreateInput(@ScriptDir, 25, 217, 240, 20)
$Browse_2 = GUICtrlCreateButton("...", 270, 217, 30, 20)
GUICtrlCreateLabel("Progress:", 90, 240, 65, 20)
GUICtrlSetFont (-1, 10, 600)
Global $Label_1 = GUICtrlCreateLabel("Waiting", 165, 240, 95, 20)
GUICtrlSetFont (-1, 10, 600)
GUISetState (@SW_SHOW)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Button_1
GUICtrlSetData($Label_1, "Scanning...")
GUICtrlSetFont (-1, 10, 600)
GUICtrlSetColor(-1, 16711680)
$ext = StringSplit(GUICtrlRead($Input3), ",")
$Amount = StringTrimRight(_ArrayToString($ext), StringLen(_ArrayToString($ext) - 2))
$Text = GUICtrlRead($Input1) & "\Inventory.txt"
If FileExists($Text) Then FileDelete($Text)
For $x = 1 To $Amount
;~ MsgBox(0, "Check", $ext[$x])
If BitAND(GUICtrlRead($Checkbox_1), $GUI_CHECKED) = $GUI_CHECKED And BitAND(GUICtrlRead($Checkbox_2), $GUI_CHECKED) = $GUI_CHECKED Then
$Inventory = _FileListToArray_Recursive(GUICtrlRead($Input2), $ext[$x], 1, 2, True)
If @Error = 4 Then MsgBox (48,"Error","No "&$ext&" Files Found.", 5)
ElseIf BitAND(GUICtrlRead($Checkbox_1), $GUI_CHECKED) = $GUI_CHECKED And BitAND(GUICtrlRead($Checkbox_2), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
$Inventory = _FileListToArray_Recursive(GUICtrlRead($Input2), $ext[$x], 1, 0, True)
If @Error=4 Then MsgBox (48,"Error","No "&$ext&" Files Found.", 5)
ElseIf BitAND(GUICtrlRead($Checkbox_1), $GUI_UNCHECKED) = $GUI_UNCHECKED And BitAND(GUICtrlRead($Checkbox_2), $GUI_CHECKED) = $GUI_CHECKED Then
$Inventory = _FileListToArray_Recursive(GUICtrlRead($Input2), $ext[$x], 1, 2, False)
If @Error=4 Then MsgBox (48,"Error","No "&$ext&" Files Found.", 5)
Else
$Inventory = _FileListToArray_Recursive(GUICtrlRead($Input2), $ext[$x], 1, 0, False)
If @Error=4 Then MsgBox (48,"Error","No "&$ext&" Files Found.", 5)
EndIf
$aText = FileOpen($Text, 1)
_FileWriteFromArray($aText, $Inventory, 1)
FileClose($aText)
Next
GUICtrlSetData($Label_1, "Done")
GUICtrlSetFont (-1, 10, 600)
GUICtrlSetColor(-1, 32768)
Sleep(2000)
$CountLines = (_FileCountLines($Text))
If $CountLines > 0 Then
MsgBox(1, "Info", "Number of file(s) in folder(s): " & $Countlines & @CRLF & "List saved at: " & $Text, 8)
Run("notepad.exe " & $Text)
EndIf
Case $msg = $Browse_1
$temppath = FileSelectFolder("Save File Where", "", 1, @ScriptDir)
GUICtrlSetData($Input1, $temppath)
Case $msg = $Browse_2
$temppath = FileSelectFolder("Choose a folder to search.", "", 1, @ScriptDir)
GUICtrlSetData($Input2, $temppath)
EndSelect
Wend
Func _FileListToArray_Recursive($sPath, $sFilter = "*", $iRetItemType = 0, $iRetPathType = 0, $bRecursive = False)
Local $sRet = "", $sRetPath = ""
$sPath = StringRegExpReplace($sPath, "[\\/]+\z", "")
If Not FileExists($sPath) Then Return SetError(1, 1, "")
If StringRegExp($sFilter, "[\\/ :> <\|]|(?s)\A\s*\z") Then Return SetError(2, 2, "")
$sPath &= "\|"
$sOrigPathLen = StringLen($sPath) - 1
While $sPath
$sCurrPathLen = StringInStr($sPath, "|") - 1
$sCurrPath = StringLeft($sPath, $sCurrPathLen)
$Search = FileFindFirstFile($sCurrPath & $sFilter)
If @error Then
$sPath = StringTrimLeft($sPath, $sCurrPathLen + 1)
ContinueLoop
EndIf
Switch $iRetPathType
Case 1 ; relative path
$sRetPath = StringTrimLeft($sCurrPath, $sOrigPathLen)
Case 2 ; full path
$sRetPath = $sCurrPath
EndSwitch
While 1
$File = FileFindNextFile($Search)
If @error Then ExitLoop
If ($iRetItemType + @extended = 2) Then ContinueLoop
$sRet &= $sRetPath & $File & "|"
WEnd
FileClose($Search)
If $bRecursive Then
$hSearch = FileFindFirstFile($sCurrPath & "*")
While 1
$File = FileFindNextFile($hSearch)
If @error Then ExitLoop
If @extended Then $sPath &= $sCurrPath & $File & "\|"
WEnd
FileClose($hSearch)
EndIf
$sPath = StringTrimLeft($sPath, $sCurrPathLen + 1)
WEnd
If Not $sRet Then Return SetError(4, 4, "")
Return StringSplit(StringTrimRight($sRet, 1), "|")
EndFunc ;==> Melba23's _FileListToArray_Recursive
Si lo deseas puedes usar también la función: FileGetAttrib("c:\") que te devuelve "D" si es un directorio, por si hay ficheros vacios no piense que es una carpeta!!