#include <File.au3>
_RemoveAll(@TempDir, "*", 0, 1)
;----------------------------------------------------------------------------------------
Func _RemoveAll($dir, $sMask = "*", $iReturn = 0, $iRecur = 0, $sProgress = "Progress")
If StringRight($dir, 1) <> "\" Then $dir &= "\"
$aList = _FileListToArrayRec($dir, $sMask, $iReturn, $iRecur)
If Not IsArray($aList) Then
ConsoleWrite($dir & " = Invalid input path" & @CRLF)
Return
Else
ProgressOn($sProgress, "0% completed")
Local $nProgress, $sFilePath, $sAttrib
For $i = 1 To $aList[0]
$sFilePath = $dir & $aList[$i]
If StringInStr(FileGetAttrib($sFilePath), "D") = 0 Then
;~ FileDelete($sFilePath)
ConsoleWrite($i & ") FileDelete: " & $sFilePath & @CRLF)
Else
;~ DirRemove($sFilePath, $DIR_REMOVE)
ConsoleWrite($i & ") DirRemove: " & $sFilePath & @CRLF)
EndIf
$nProgress = Int($i / $aList[0] * 100)
ProgressSet($nProgress, "", $nProgress & "% completed")
Next
EndIf
EndFunc ;==>_FindAllFilez
;----------------------------------------------------------------------------------------