Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Valid filename
Message
From
09/03/2011 03:32:24
 
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
01502980
Message ID:
01502987
Views:
53
>>>I have a backup menu dan the client can create his own backup filename.
>>>
>>This is what we use, is was from Chris Lange I think
>>
>>********************************************************************
>>FUNCTION lValidFileName( tcFileName )
>>********************************************************************
>>  LOCAL lcValidChars, lcUpperJustFileName
>>
>>  m.lcValidChars        = " ^'@{}[],=()+._-!$%&/#~1234567890ABCEDFGHIJKLMONPQRSTUVWXYZ"
>>  m.lcUpperJustFileName = UPPER( JUSTFNAME(m.tcFileName) )
>>
>>    DO CASE
>>	CASE EMPTY( m.lcUpperJustFileName )
>>		RETURN .F.
>>	CASE INLIST( JUSTSTEM(m.lcUpperJustFileName), "AUX", "COM1", "COM2", "COM3", "COM4", "CON", "LPT1", "PRN" ) 
>>		RETURN .F.
>>	CASE LEN( CHRTRAN( m.lcUpperJustFileName, m.lcValidChars, "" ) ) > 0
>>		RETURN .F.
>>	OTHERWISE
>>		RETURN .T.
>>    ENDCASE
>>
>>ENDFUNC 
>>
>
>Here is slightly different way
>
>List of invalid chars in the file name and path

Could be shorter:
FUNCTION GetInvalidFileNameChars()
RETURN "/\" + GetInvalidPathChars()
Previous
Reply
Map
View

Click here to load this message in the networking platform