;Check for the timestamp on the file prior to deletion ;Statements establish todays date and subtracts 7 days from it ;Places the date into the variable x. x = %A_NowUTC% x += -7, Days ;Successful Loop Statements Time = %x% OldFile = Loop c:\source\*.dat* ; Loop the folder for specific files or all files { If (A_LoopFileTimeModified < Time) { OldFile := A_LoopFileLongPath filerecycle, %OldFile% } } ;Empty the recely bin fileRecycleEmpty
Deleting Files that are older than a specified time
Started by
shaunsisk
, Jul 18 2006 06:21 PM
2 replies to this topic
This script allows for the deletion of files or folders that are older than a specific date and are of a specific file type or can be changed to delete all files in a folder. The script sends the files to the recycle bin and then empties the recycle bin to clear up disk space. GREAT FOR LOG FILES ON SERVERS!
#1
-
Posted 18 July 2006 - 06:21 PM
The only things in life you regret, are the chances you didn't take.
I don't understand why you send files to the recycle bin to empty it just after.
Is this some trick? Otherwise, a simple FileDelete would have been enough.
Is this some trick? Otherwise, a simple FileDelete would have been enough.
#2
-
Posted 19 July 2006 - 07:42 AM
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")