Lists files and\or folders in a specified path (Similar to using Dir with the /B Switch)
#include <File.au3>
_FileListToArray($sPath [, $sFilter = "*" [, $iFlag = 0]])
| $sPath | Path to generate filelist for. |
| $sFilter | [optional] the filter to use, default is *. Search the AutoIt3 helpfile for the word "WildCards" For details. |
| $iFlag | [optional] specifies whether to return files folders or both $iFlag=0(Default) Return both files and folders $iFlag=1 Return files only $iFlag=2 Return Folders only |
| Success: | an Array, see remarks |
| Failure: | 0 |
| @Error: | 1 = Path not found or invalid |
| 2 = Invalid $sFilter | |
| 3 = Invalid $iFlag | |
| 4 = No File(s) Found |
#include <File.au3>
#include <Array.au3>
Local $FileList = _FileListToArray(@DesktopDir)
If @error = 1 Then
MsgBox(0, "", "No Folders Found.")
Exit
EndIf
If @error = 4 Then
MsgBox(0, "", "No Files Found.")
Exit
EndIf
_ArrayDisplay($FileList, "$FileList")