File Name Parsing

The following function can be used to parse file name paths and extract different parts like the path, the file name, the type (extension) etc.

   

filenameFromPath <filename_string> 	 

Returns the file name and extension of a full file name, useful for labeling file buttons in rollout panels.

   

getFilenamePath <filename_string>   

Returns the directory path part of a full file name.

   

getFilenameFile <filename_string> 

Returns the file name part of a full file name.

   

getFilenameType <filename_string> 

Returns the type extension part of a full file name.

   

doesFileExist <filename_string> 

Returns true if the file exists, false otherwise.

   

pathIsNetworkPath <file_path> 

[ AVG ] Returns true if the specified file path has a UNC network path signature (\\someslave\) and false if it has a local path signature (D:\) where D: is a drive letter.

Available since 3ds Max 2008.

The method does not test for the path's existence, it only checks the signature of the path to see if it is UNC or local.

See also pathConfig.isUncPath() in the PathConfig Struct topic.

EXAMPLES:

file="g:\\subdir1\\subdir2\\myImage.jpg"
filenameFromPath file -- returns: "myImage.jpg"
getFilenamePath file -- returns: "g:\subdir1\subdir2\"
getFilenameFile file -- returns: "myImage"
getFilenameType file -- returns: ".jpg"
pathIsNetworkPath "c:\\temp\\test.txt" --returns: false
pathIsNetworkPath "\\\\someserver\\temp\\test.txt" --returns: true

See Also