CheckFullFilename()
CheckFullFilename()
We have CheckFilename() for the name of the file but what about something like CheckPath() (with optional parameter for checking the hard disk letter or not) that validates the path and CheckFullFilename() that checks the complete filename for not allowed characters.
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
Re: CheckFullFilename()
It is easy to make one by yourself by combining FindString(), StringField() and CheckFilename().
Re: CheckFullFilename()
Or a FileSize() Macro...

Code: Select all
Macro FileExists(Fname)
; 0 = File or Folder does not exist
; 1 = File Exists
; -1 = Folder Exists
; Since FileSize() returns:
; -1 = File Not found.
; -2 = File is a directory.
; 0 = Empty File, > 1 = File Exists
; FileSize() respects '*' wildcards and reports results accordingly.
FileSize(Fname) + 1
EndMacro
Define.i fn
CreateDirectory("c:\z~z\")
fn=CreateFile(0,"c:\z~z\1.txt"): CloseFile(0)
fn=CreateFile(0,"c:\z~z\2.txt"): CloseFile(0)
Debug " - File(s) or Folder Exists? - "
Debug FileExists("c:\zz~z\") ; 0 = Not a Folder
Debug FileExists("c:\z~z\*.*") ; -1 = Valid Folder
Debug FileExists("c:\z~z\*.txt") ; 1 = Valid File(s)
Debug FileExists("c:\z~z\1.txt") ; 1 = Valid File
Debug FileExists("c:\z~z\3.txt") ; 0 = Not a File
Debug FileExists("c:\z~z\*.csv") ; 0 = File(s) Not Found
Debug FileExists("c:\z~z\?,3") ; 0 = File Not Found
;DeleteDirectory("c:\z~z\", "*.*", #PB_FileSystem_Recursive)
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum