$StartPfad = "C:\Dokumente und Einstellungen" $SuchOrdner = "XYZ" $Daten = _GetFileList($StartPfad, "n",1) $file = FileOpen(@MyDocumentsDir & "\Remove.log", 1) ; Logfile mit Eintrag der gelöschten Ordner FileWriteLine($file, "Start: [" & @YEAR & "-" & @MON & "-" & @MDAY & " / " & @HOUR & ":" & @MIN & ":" & @SEC & "]" & @CRLF & "gelöscht wurden:") For $i = 1 To $Daten[0] If StringRight($Daten[$i], StringLen($Daten[$i]-StringInStr($Daten[$i], "\", Default, -1))) = $SuchOrdner Then MsgBox(0, '', "Lösche: " & $Daten[$i]) ; nur zur Kontrolle DirRemove($Daten[$i], 1) FileWriteLine($file, $Daten[$i]) EndIf Next FileWriteLine($file, "Ende: [" & @YEAR & "-" & @MON & "-" & @MDAY & " / " & @HOUR & ":" & @MIN & ":" & @SEC & "]") FileClose($file) MsgBox(0, '', "Ich haben fertig...") ; AutoIt Version: 3.0 ; Language: English ; Platform: Win9x/NT/XP ; Author: jos van der Zande ; ; Find files in directory and subdirectories and return it in an Array, all coded in Autoit3 ; ;******************************************************************************** ;Recursive search for filemask ;******************************************************************************** Func _GetFileList($T_DIR,$T_MASK,$DIR_ONLY=0) Dim $N_DIRNAMES[200000] ; max number of directories that can be scanned Local $N_DIRCOUNT = 0 Local $N_FILE Local $N_SEARCH Local $N_TFILE Local $N_OFILE Local $T_FILENAMES Local $T_FILECOUNT Local $T_DIRCOUNT = 1 Local $FILEMASK ; check Filemask \ for empty File-Array by GetDirOnly If $FILEMASK = "n" Then $FILEMASK = "*.no" ; remove the end \ If specified If StringRight($T_DIR,1) = "\" Then $T_DIR = StringTrimRight($T_DIR,1) $N_DIRNAMES[$T_DIRCOUNT] = $T_DIR ; Exit if base dir doesn't exists If Not FileExists($T_DIR) Then Return 0 ; keep on looping until all directories are scanned While $T_DIRCOUNT > $N_DIRCOUNT $N_DIRCOUNT = $N_DIRCOUNT + 1 ; find all subdirs in this directory and save them in a array $N_SEARCH = FileFindFirstFile($N_DIRNAMES[$N_DIRCOUNT] & "\*.*") While 1 $N_FILE = FileFindNextFile($N_SEARCH) If @error Then ExitLoop ; skip these references If $N_FILE = "." Or $N_FILE = ".." Then ContinueLoop $N_TFILE = $N_DIRNAMES[$N_DIRCOUNT] & "\" & $N_FILE ; if Directory than add to the list of directories to be processed If StringInStr(FileGetAttrib( $N_TFILE ),"D") > 0 Then $T_DIRCOUNT = $T_DIRCOUNT + 1 $N_DIRNAMES[$T_DIRCOUNT] = $N_TFILE EndIf Wend FileClose($N_SEARCH) ; find all Files that mtach the MASK $N_SEARCH = FileFindFirstFile($N_DIRNAMES[$N_DIRCOUNT] & "\" & $T_MASK ) If $N_SEARCH = -1 Then ContinueLoop While 1 $N_FILE = FileFindNextFile($N_SEARCH) If @error Then ExitLoop ; skip these references If $N_FILE = "." Or $N_FILE = ".." Then ContinueLoop $N_TFILE = $N_DIRNAMES[$N_DIRCOUNT] & "\" & $N_FILE ; if Directory than add to the list of directories to be processed If StringInStr(FileGetAttrib( $N_TFILE ),"D") = 0 Then $T_FILENAMES = $T_FILENAMES & $N_TFILE & @CR $T_FILECOUNT = $T_FILECOUNT + 1 ;MsgBox(0,'filecount ' & $T_FILECOUNT ,$N_TFILE) EndIf Wend FileClose($N_SEARCH) Wend If $DIR_ONLY = 0 Then $T_FILENAMES = StringTrimRight($T_FILENAMES,1) $N_OFILE = StringSplit($T_FILENAMES,@CR) Return( $N_OFILE ) Else ReDim $N_DIRNAMES[$N_DIRCOUNT+1] $N_DIRNAMES[0] = $N_DIRCOUNT Return $N_DIRNAMES EndIf EndFunc ;==>_GetFileList