AutoHotkey Community

It is currently May 27th, 2012, 10:10 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 

Was this Code Helpful?
Poll ended at August 17th, 2006, 7:21 pm
yes 50%  50%  [ 1 ]
no 50%  50%  [ 1 ]
Total votes : 2
Author Message
PostPosted: July 18th, 2006, 7:21 pm 
Offline

Joined: July 18th, 2006, 7:10 pm
Posts: 1
Location: Chicago
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!


Code:

;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

_________________
The only things in life you regret, are the chances you didn't take.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 19th, 2006, 8:42 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
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.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 19th, 2006, 10:42 am 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
Well you can comment out the last line if you don't want them deleted permanently.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: specter333, sumon and 24 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group