#include <File.au3>
$src = FileSelectFolder('Please, choose folder to process', '', 1 + 2 + 4, @ScriptDir)
If @error Then Exit
$filter = 'tmp|temp'; any other file extensions to be excluded from copy list separated by pipe "|"
_Delete($src, $filter)
Func _Delete($source, $filter = 'tmp|temp')
;MsgBox(0, '', $source & @CRLF & $destination)
$aFolders = _FileListToArray($source, '*', 2); Folders
$aFiles = _FileListToArray($source, '*', 1); Files
If Not IsArray($aFolders) AND Not IsArray($aFiles) Then Return ''; No files or fodlers found in source path
For $j = 1 to $aFiles[0]
$ext = _ExtDefine($aFiles[$j])
If StringInStr($filter, $ext) Then FileDelete($source & '\' & $aFiles[$j])
Next
For $i = 1 to $aFolders[0]
$new_source = $source & '\' & $aFolders[$i]
_Delete($new_source, $filter); Recursive processing for subfolders
Next
EndFunc
;;; Function for determination of file extension
Func _ExtDefine($file)
If StringInStr($file, '\') Then
$aFile = StringSplit($file, '\')
$file = $aFile[$aFile[0]]
EndIf
If Not StringInStr($file, '.') Then Return ''
$aFile = StringSplit($file, '.')
Return $aFile[$aFile[0]]
EndFunc