Determine Invalid Characters in File Name and Path

This is sample code. Add error handling and adjust to your requirements as necessary.

* Returns the list of characters that are not allowed in the file names
FUNCTION GetInvalidFileNameChars()
LOCAL lcInvalidFileNameChars, lnAsc
lcInvalidFileNameChars = [*/:<>?|\] + CHR(34)
FOR lnAsc=0 TO 31
	lcInvalidFileNameChars = lcInvalidFileNameChars + CHR(lnAsc)
ENDFOR
RETURN lcInvalidFileNameChars
 
 
* Returns the list of characters that are not allowed in the path names
FUNCTION GetInvalidPathChars()
LOCAL lcInvalidPathChars, lnAsc
lcInvalidPathChars = [*:<>?|] + CHR(34)
FOR lnAsc=0 TO 31
	lcInvalidPathChars = lcInvalidPathChars + CHR(lnAsc)
ENDFOR
RETURN lcInvalidPathChars
Your rating: None Average: 3 (2 votes)