Lösche alle Dateien (keine Ordner) im angegebenen Pfad rekursiv.
Dim System Dim Drive ReDim Location(0) DIM i i = 0 Pfad = "F:\TransferDir\" Set System = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("Shell.Application") On error Resume next Call FindFile(Pfad) Call FindFileRekursiv(Pfad,i) '---------------------------------------------------------------------------' Sub FindFile(Pfad) DIM objFolder,Datei Set objFolder = system.GetFolder(Pfad ) For Each Datei in objFolder.Files System.DeleteFile(Datei.Path) ' wscript.echo Datei.Path Next End Sub '--------------------------------------------------------------------------- Sub FindFileRekursiv(ThisFolder,i) Dim File Dim Folder For Each Folder In System.GetFolder(ThisFolder).SubFolders For Each File In Folder.Files Location(Ubound(Location)) = File ReDim Preserve Location(Ubound(Location) + 1) ' wscript.echo i & Location(i) System.DeleteFile(Location(i)) i = i+1 Next 'File Call FindFileRekursiv(Folder,i) Next 'Folder End Sub