Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Array.au3>
- #include <File.au3>
- If MsgBox(4,"","Fortfahren?") = 7 Then Exit
- $files = _GetFilesFolder_Rekursiv(@ScriptDir)
- For $i = 1 To $files[0] Step 1
- If StringInStr($files[$i],".jpg") Or StringInStr($files[$i],".png") Or StringInStr($files[$i],".avi") Or StringInStr($files[$i],".mp4") Then
- FileDelete($files[$i])
- EndIf
- Next
- MsgBox(0,"Fertig","Fertig, Maru")
- Func _GetFilesFolder_Rekursiv($sPath, $sExt='*', $iDir=-1, $iRetType=0, $sDelim='0')
- Global $oFSO = ObjCreate('Scripting.FileSystemObject')
- Global $strFiles = ''
- Switch $sDelim
- Case '1'
- $sDelim = @CR
- Case '2'
- $sDelim = @LF
- Case '3'
- $sDelim = ';'
- Case '4'
- $sDelim = '|'
- Case Else
- $sDelim = @CRLF
- EndSwitch
- If ($iRetType < 0) Or ($iRetType > 1) Then $iRetType = 0
- If $sExt = -1 Then $sExt = '*'
- If ($iDir < -1) Or ($iDir > 1) Then $iDir = -1
- _ShowSubFolders($oFSO.GetFolder($sPath),$sExt,$iDir,$sDelim)
- If $iRetType = 0 Then
- Local $aOut
- $aOut = StringSplit(StringTrimRight($strFiles, StringLen($sDelim)), $sDelim, 1)
- If $aOut[1] = '' Then
- ReDim $aOut[1]
- $aOut[0] = 0
- EndIf
- Return $aOut
- Else
- Return StringTrimRight($strFiles, StringLen($sDelim))
- EndIf
- EndFunc
- Func _ShowSubFolders($Folder, $Ext='*', $Dir=-1, $Delim=@CRLF)
- If Not IsDeclared("strFiles") Then Global $strFiles = ''
- If ($Dir = -1) Or ($Dir = 0) Then
- For $file In $Folder.Files
- If $Ext <> '*' Then
- If StringRight($file.Name, StringLen($Ext)) = $Ext Then _
- $strFiles &= $file.Path & $Delim
- Else
- $strFiles &= $file.Path & $Delim
- EndIf
- Next
- EndIf
- For $Subfolder In $Folder.SubFolders
- If ($Dir = -1) Or ($Dir = 1) Then $strFiles &= $Subfolder.Path & '\' & $Delim
- _ShowSubFolders($Subfolder, $Ext, $Dir, $Delim)
- Next
- EndFunc
Add Comment
Please, Sign In to add comment