#include <Array.au3>
Local $Fsf = FileSelectFolder('','')
If @error Then Exit
Local $Ps = _FFSearch($Fsf, '', 1, 0, 2)
If @error Then Exit
Local $Array[UBound($Ps)][3]
For $i = 0 To UBound($Array) - 1
$Array[$i][0] = $Ps[$i]
$Array[$i][1] = StringRegExpReplace($Ps[$i], '.*\\', '')
$Array[$i][2] = FileGetSize($Ps[$i])
Next
_ArrayDisplay($Array)
Func _FFSearch($sPath, $sExt = '', $iPart = 0, $iDepth = 0, $aArray = 1)
$sPath = StringStripWS($sPath, 3)
$iPart = Number($iPart)
$iDepth = Number($iDepth)
$aArray = Number($aArray)
Select
Case $sPath = ''
Return SetError(1)
Case ($iPart < 0 Or $iPart > 6) And $iPart <> 11
Return SetError(3)
Case $iDepth < 0 Or $iDepth > 1
Return SetError(4)
Case $aArray < 1 Or $aArray > 2
Return SetError(5)
EndSelect
If StringCompare(StringRight($sPath, 1), '\') Then $sPath = $sPath & '\'
Local $sFileList
If StringInStr($sExt, '|') Then
Local $sDelim = StringSplit($sExt, '|', 1)
For $i = 1 To $sDelim[0]
__FFSearchAll($sFileList, $sPath, $sDelim[$i], $iPart, $iDepth)
If @error Then Return SetError(6)
Next
Else
__FFSearchAll($sFileList, $sPath, $sExt, $iPart, $iDepth)
If @error Then Return SetError(6)
EndIf
$sFileList = StringTrimRight($sFileList, 1)
If Not $sFileList Then Return SetError(7)
$sFileList = StringSplit($sFileList, '|', $aArray)
Return $sFileList
EndFunc ;==>_FFSearch
Func __FFSearchAll(ByRef $sFileList, $sPath, $sExt = '', $iPart = 0, $iDepth = 0)
Local $sFile = '', $hFirstFile = FileFindFirstFile($sPath & '*'), $lastpoint, $RetString = ''
If $hFirstFile = -1 Then Return SetError(1)
While 1
$sFile = FileFindNextFile($hFirstFile)
If @error Then ExitLoop
If @extended Then
If $sExt Then
Switch $iPart
Case 0
If StringInStr($sFile, $sExt) Then $sFileList &= $sPath & $sFile & '|'
Case 4
If Not StringCompare($sFile, $sExt) Then $sFileList &= $sPath & $sFile & '|'
Case 5, 11
If Not DirGetSize($sPath & $sFile) Then $sFileList &= $sPath & $sFile & '|'
EndSwitch
Else
Switch $iPart
Case 0, 4
$sFileList &= $sPath & $sFile & '|'
Case 5, 11
If Not DirGetSize($sPath & $sFile) Then $sFileList &= $sPath & $sFile & '|'
EndSwitch
EndIf
If Not $iDepth Then __FFSearchAll($sFileList, $sPath & $sFile & '\', $sExt, $iPart, $iDepth)
Else
If $sExt Then
$lastpoint = StringInStr($sFile, '.', 0, -1)
Switch $iPart
Case 0
$RetString = StringLeft($sFile, $lastpoint - 1)
If StringInStr($RetString, $sExt) Then $sFileList &= $sPath & $sFile & '|'
Case 1
If Not StringCompare($sFile, $sExt) Then $sFileList &= $sPath & $sFile & '|'
Case 2
$RetString = StringLeft($sFile, $lastpoint - 1)
If Not StringCompare($RetString, $sExt) Then $sFileList &= $sPath & $sFile & '|'
Case 3
$RetString = StringTrimLeft($sFile, $lastpoint)
If Not StringCompare($RetString, $sExt) Then $sFileList &= $sPath & $sFile & '|'
Case 6, 11
If Not FileGetSize($sPath & $sFile) Then $sFileList &= $sPath & $sFile & '|'
EndSwitch
Else
Switch $iPart
Case 0 To 3
$sFileList &= $sPath & $sFile & '|'
Case 6, 11
If Not FileGetSize($sPath & $sFile) Then $sFileList &= $sPath & $sFile & '|'
EndSwitch
EndIf
EndIf
WEnd
FileClose($hFirstFile)
EndFunc ;==>__FFSearchAll