SplitPath

(Engine-Level Function)

Description: Breaks up a file path name into its components.
Returns: Nothing (path components are returned in the parameters)
Usage: Script or steady state.
Function Groups: File I/O
Related to: Dir | FileFind
Format: SplitPath(FullName, Drive, Path, File, Extension)
Parameters:  
FullName
Required. Any text expression giving the full path name.
Drive
Required. Any variable, which is set to the drive letter in FullName, plus a colon. If FullName doesn't contain a drive specification, Drive is a null string. If this information is not required, a constant may be used for this parameter.
Path
Required. Any variable, which is set to the directory path in FullName, ending in a backslash. If FullName doesn't contain a path specification, Path is a null string. If this information is not required, a constant may be used for this parameter.
File
Required. Any variable, which is set to the file name in FullName. If FullName doesn't specify a file name, File is a null string. If this information is not required, a constant may be used for this parameter.
Extension
Required. Any variable, which is set to the file extension in FullName, including a period). If FullName doesn't specify a file extension, Extension is a null string. If this information is not required, a constant may be used for this parameter.

This function is session non-aware, meaning it works on the server's file system even with an active remote connection established.This function is also blocking. All concurrent thread operations will be paused until its execution has concluded. Avoid using this function to access a network file path ("\\server1\share\file.txt", for example). If the network location is unavailable while a blocking File I/O function is attempted, it will block indefinitely. It is recommended that a target file be copied to the local file system for access rather than over the network from VTScada.

Examples:

SplitPath("C:\MyApps\App1\Info.TXT", drv, pth, fName, ext);

The values of drv, pth, fName and ext will be "C:", "\MyApps\App1\", "Info" and ".TXT" respectively.

SplitPath("D:\Apps\Profiler\GDI.WIF", drv, pth, 0, 0);
appPath = Concat(drv, pth);

Note the use of "0" for parameters that are not required.