That function wil return TRUE for "*.jpg" because it allows wildcards....c4s wrote:...Also it's often a tip here for newbies:jassing wrote:The docs says to use it to check for the existence of a file... a file. So an invalid file should return -1PB wrote:Filesize checks the size of the specified file. An asterisk is not specifying a file. No bug.Pseudo conversation wrote:A: How can I find out if a file exists?
B: Use FileSize() like this:A: Ah great, I really didn't know I could use this function for it...thanks.Code: Select all
Procedure FileExists(File.s) Protected Result If FileSize(File) >= 0 Result = #True Else Result = #False ; Doesn't exist or a folder EndIf ProcedureReturn Result EndProcedure
You must also check to ensure that the file name is valid.