Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

delete files by date

$
0
0
hi my friends,,,

really i miss you

forever i need your help by this famous forum

i want delete old files that are created befor 20 days in some folder

really i try to do some script but i feel headache because this script is difficult

#include <File.au3>
#include <Array.au3>
Local $FileList = _FileListToArray(@DesktopDir&"\New folder")
If @error = 4 Then
MsgBox(0, "", " Folder is empty.")
Exit
Else
MsgBox(0,""," folder is not empty")
Global $aList=(@DesktopDir&"\New folder\*.*")
Global $aList_2D[UBound($aList)][2]

For $i = 1 To $aList[0]
$aList_2D[$i][0] = $aList[$i]
$aList_2D[$i][1] = StringRegExpReplace($aList[$i], ".*(\d\d).(\d\d).(\d\d).(\d\d).(\d\d).(\d\d).*", "$3$1$2$4$5$6")
Next
For $i = 20 To $aList[0]
FileDelete($sPath & $aList_2D[$i][0]
Next
EndIf



Viewing all articles
Browse latest Browse all 12506

Trending Articles