Bewerken

Delen via


FileSystemProxy.GetName(String) Method

Definition

Parses the file name out of the path provided.

public:
 System::String ^ GetName(System::String ^ path);
public string GetName (string path);
member this.GetName : string -> string
Public Function GetName (path As String) As String

Parameters

path
String

Required. Path to be parsed. String.

Returns

The file name from the specified path.

Examples

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.

Remarks

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 examples of tasks involving the My.Computer.FileSystem.GetFileName method.

To See
Parse a file path How to: Parse File Paths

Applies to

See also