How to: Parse File Paths in Visual Basic
Theoffers a number of useful methods when parsing file paths.
Thetakes two paths and returns a properly formatted combined path.
Thereturns the absolute path of the parent of the provided path.
Thereturns a object that can be queried to determine the file's properties, such as its name and path.
Do not make decisions about the contents of the file based on the file name extension. For example, the file Form1.vb may not be a Visual Basic source file.
To determine a file's name and path
Use theand properties of the FileInfo object to determine a file's name and path. This example determines the name and path and displays them.
To combine a file's name and directory to create the full path
Use the CombinePath method, supplying the directory and name. This example takes the strings folderPath and fileName created in the previous example, combines them, and displays the result.