Page 1 of 1

File Timestamp

Posted: Thu Jul 15, 2010 11:38 am
by Waussie
Hi,

I'm trying to code the following:

Search a directory for files with a specific fileextension and get the newest file according to windows timestamp.
I need to get it based on time instead of date, but can't find any commands for it in Purebasic.
Anyone have any ideas?

Re: File Timestamp

Posted: Thu Jul 15, 2010 12:54 pm
by Waussie
I managed to code this, using this code:

NbFiles=SearchFilesInit("H:\My Documents\","*.stv",0)

Repeat
File$=SearchFilesGet()
If File$="" : Break : EndIf
datum$ = FormatDate("%yyyy%mm%dd%hh%ii%ss", GetFileDate(File$, #PB_Date_Modified))
If Val(datum$) > Val(datumlast$)
datumlast$ = datum$
laatste$ = File$
EndIf

ForEver

MessageRequester("Last created .stv file was: ", laatste$,#PB_MessageRequester_Ok)