Funnily enough, I have written something to do just what you ask I now remember. I never used it though, so thorough testing is advised!
Func GetLatestFile($DirPath, $FileSpec)
; Shows the filenames of all files in the current directory.
$search = FileFindFirstFile($DirPath & "\" & $FileSpec)
$LatestFile = ""
$LatestTime = 0
; Check if the search was successful
If $search = -1 Then
MsgBox(0, "Error", "No files/directories matched the search pattern")
$file = FileFindNextFile($search)
if @error then ExitLoop
if StringInStr(FileGetAttrib($DirPath & "\" & $file), "D") > 0 Then
; Skip directories
$FileTime = FileGetTime($DirPath & "\" & $file,0,1)
if $FileTime > $LatestTime Then
$LatestFile = $File
$LatestTime = $FileTime