Jump to content

Recommended Posts

Posted

I would like to determine if a file is older than 18 hours so that I can overwrite it. I know the keyword is filegettime but it is not so straightforward. Please help.

Posted

I would like to determine if a file is older than 18 hours so that I can overwrite it. I know the keyword is filegettime but it is not so straightforward. Please help.

An example:

#include <Date.au3>
$FILE = FileOpenDialog("SELECT",@ScriptDir,"All (*.*)",1)
$TIME = FileGetTime($FILE,0,0)
$TIME1 = $TIME[0] & "/" & $TIME[1] & "/" & $TIME[2] & " " & $TIME[3] & ":" & $TIME[4] & ":" & $TIME[5]
$TIME2 = _NowCalc()
If _DateDiff("h",$TIME1,$TIME2) > 18 Then
    MsgBox(0,"","File can be overwrite")
Else
    MsgBox(0,"","File cannot be overwrite")
EndIf

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
×
×
  • Create New...