Visual Basic Scripting Edition | Language Reference |
Returns the last file name or folder of a specified path that is not part of the drive specification.
object.GetFileName(pathspec)
object
Required. Always the name of a FileSystemObject.
pathspec
Required. The path (absolute or relative) to a specific file.
The GetFileName method returns a zero-length string ("") if pathspec does not end with the named file or folder.
The following example illustrates use of the GetFileName method:
Function GetAName(DriveSpec)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
GetAName = fso.GetFileName(DriveSpec)
End Function
Note The GetFileName method works only on the provided path string. It does not attempt to resolve the path, nor does it check for the existence of the specified path.
GetAbsolutePathName Method | GetBaseName Method | GetDrive Method | GetDriveName Method | GetExtensionName Method | GetFile Method | GetFolder Method | GetParentFolderName Method | GetSpecialFolder Method | GetTempName Method
Applies To: FileSystemObject Object