Returns one or more properties of a specified file and pathname
Class: String
Parameters: $file – Full path and filename to parse
mode – Integer specifying the parsing mode. Sum of the values below
Syntax: $returnString=$parse($file, mode)
Returns: Dependant on mode value which is sum of:
• 1 Include the root as either drive or UNC path
• 2. Include the full path from the root
• 4. Include the name of the file, less extension
• 8. Include the extension of the file if exists
• 16. Resolve any relative paths
• 32. Use 8.3 file naming convention
• 64. Convert local files to UNC if possible
• 128. Convert mapped drives to UNC
Remarks: None
Example:
//Examples for the string $parse method
//Folder C:\DEMO shared as 'MYSHARE'
$myfile=”C:\DEMO\MYTESTFILE.TXT” //Set file
$result=$parse($myfile, 1) //Return drive letter (=’C:’)
$result=$parse($myfile, 12) //Return filename and extension (=’MYTESTFILE.EXT’)
$result=$parse($myfile, 44) //Return filename and extension in 8.3 format(=’MYTEST~1.EXT’)
$result=$parse($myfile, 79) //Return full path, name and extension of local file in UNC format (=’\\SRV1\MYSHARE\MYTESTFILE.EXT’)
$myfile=”S:\DEMO2\MYTESTFILE2.TXT” //Set new file located on server
$result=$parse($myfile, 143) //Return full path, name and extension of remote file in UNC format (=’\\SRV2\MYSHARE2\DEMO2\MYTESTFILE.EXT’)