Sign in to follow this  
Followers 0
Reslan

Deleting files using their date of creation

8 posts in this topic

#1 ·  Posted (edited)

Hi,

First i want to apologize if my question seems stupid or if the answer is actually easy to find, but i'm somewhat new to AutoIT and although i love this tool, i'm far from an expert at creating scripts with it.

So, my needs:

I want to make a script which compares the date of creation of all files in a folder with the current system date. If the date is older than, let's say, 7 days, i want the script to delete the file.

I found a function wich is called FileGetTime, i could probably manage to get the date of the concerned files as a variable but i don't know what to do on next step: comparing the date returned from FileGetTime with current system date and execute a command if the delta between the date is > 7

Well, to be more precise i want to delete some IIS Log Files once they are older thant one or two weeks. These are very big files (~ 200 MB / day) and i badly need something to clean it automatically.

I know this is possible using vbscript but i found autoit to be fare more powerful than regular vbscript so if possible i would like to use it for every administrative automation.

Oh and by the way, i know my english is at best "acceptable" and i fully apologize for the mistakes i probably made.

Regards,

Reslan.

Edited by Reslan

Share this post


Link to post
Share on other sites



Thanks a lot, it seems to be exactly what i'm after. Nevertheless i couldn't find the script file you include "date.au3" on your personnal page; where could i find it?

maybe

C:\Program Files\AutoIt3\Include\Date.au3


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

maybe

C:\Program Files\AutoIt3\Include\Date.au3

omg :whistle:

Share this post


Link to post
Share on other sites

Should just find it since its installed in the default Include subdirectory ... :whistle:

Yup sorry i didn't even open the include folder before today...

Share this post


Link to post
Share on other sites

Yup sorry i didn't even open the include folder before today...

It works perfectly, huge thanks for you Sir :whistle:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0