No, you don't need to call ExamineDirectory() again, I meant to show you need to add the full path to the filename. No API needed either.
GetFileDate() is not based on ExamineDirectory(), so it doesn't know which folder you're looking at, so you usually need to specify a full path.
BUT, when I replied, I forgot about DirectoryEntryDate(), a similar function which IS based on ExamineDirectory():
Code: Select all
ExaminedDir$ = GetHomeDirectory()
If ExamineDirectory(0, ExaminedDir$, "")
While NextDirectoryEntry(0)
FileName$ = DirectoryEntryName(0)
If DirectoryEntryType(0) = #PB_DirectoryEntry_Directory
;Debug "[DIR] " + FileName$
Else
; D$ is not rquired, only added for clarity
; bad
Debug FileName$ + " " + FormatDate("%yyyy/%mm/%dd - %hh:%ii:%ss", GetFileDate(FileName$, #PB_Date_Modified))
; good
Debug FileName$ + " " + FormatDate("%yyyy/%mm/%dd - %hh:%ii:%ss", GetFileDate(ExaminedDir$ + FileName$, #PB_Date_Modified))
; good
Debug FileName$ + " " + FormatDate("%yyyy/%mm/%dd - %hh:%ii:%ss", DirectoryEntryDate(0, #PB_Date_Modified))
Debug ""
EndIf
Wend
FinishDirectory(0)
EndIf