FileSystem.GetName Method (String)

 

Parses the file name out of the path provided.

Namespace:   Microsoft.VisualBasic.FileIO
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

public static string GetName(
	string path
)

Parameters

path
Type: System.String

Required. Path to be parsed. String.

Return Value

Type: System.String

The file name from the specified path.

This is a string operation; the FileSystem is not examined.

The GetName method ignores a slash mark occurring at the end of the path.

The following table lists an example of a task involving the My.Computer.FileSystem.GetFileName method.

To

See

Parse a file path

How to: Parse File Paths in Visual Basic

The following example parses a file path and returns the name of the file.

MsgBox("The filename is: " &
My.Computer.FileSystem.GetName("C:\testdirectory\testfile"))

Replace the path C:\Testdirectory\Testfile with the path you wish to parse.

.NET Framework
Available since 2.0
Return to top
Show: