GetFileDate + GetFileTime
BlitzMax Forums/BlitzMax Programming/GetFileDate + GetFileTime
| ||
Do you guys have any idea how I'd use the Win32 GetFileTime command to retrieve a file's last written date and time? I'm writing a program that'll only compress files that haven't been updated recently. I've been trying to edit this for bmx: http://www.blitzbasic.com/codearcs/codearcs.php?code=1442 Any help would be appreciated. I've been racking my brains with all the @s, buffers, floats, toCStrings, etc! |
| ||
Extended Time Function Module |
| ||
Tony, I get an Internal Error from that link. |
| ||
Hmmm... What about this one ? |
| ||
After all the messing around,Local time:Int = FileTime("c:\autoexec.bat") Local tm :Int Ptr = Int Ptr(localtime_(Varptr(time))) Print "time:" +time Print "sec:" +tm[0] Print "min:" +tm[1] Print "hour:" +tm[2] Print "day:" +tm[3] Print "month:"+(tm[4]+1) Print "year:" +(tm[5]+1900) Print "wday:" +tm[6] Print "yday:" +(tm[7]+1) Did it all. Weird! Thanks Tony. |
| ||
This works nicely.Strict Local i:fileInformation=New fileInformation i.checkFile("c:\autoexec.bat") Type fileInformation Field name$ Field longtime Field hour,minute,second Field day,month,year Method checkFile(file$) name=file Local time:Int = FileTime(file) Local tm:Int Ptr = Int Ptr(localtime_(Varptr(time))) longtime=time hour=tm[2] minute=tm[1] second=tm[0] day=tm[3] month=(tm[4]+1) year=(tm[5]+1900) End Method Method getTidyString_Time$() Return hour+":"+minute+":"+second End Method Method getTidyString_Date$() Return day+"/"+month+"/"+year End Method Method getTidyString_all$() Return getTidyString_Time()+" "+getTidyString_Date() End Method Method compare(s:Object) Local o:fileInformation=fileInformation(s) If o <> Null If o.longtime=longtime Return 0 ElseIf o.longtime> longtime Return 1 Else Return -1 EndIf EndIf End Method End Type |