Returns the last component of specified path that is not part of the drive specification.
object.GetFileName(pathspec)
The GetFileName method returns a zero-length string ("") if pathspec does not end with the named component.
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.
The following example illustrates the use of the GetFileName method.
[JScript] function ShowFileName(filespec) { var fso, s = ""; fso = new ActiveXObject("Scripting.FileSystemObject"); s +=fso.GetFileName(
filespec)
; return(s); } [VBScript] Function GetAName(DriveSpec) Dim fso Set fso = CreateObject("Scripting.FileSystemObject") GetAName =fso.GetFileName(
DriveSpec)
End Function
GetAbsolutePathName Method | GetBaseName Method | GetDrive Method | GetDriveName Method | GetExtensionName Method | GetFile Method | GetFileVersion Method | GetFolder Method | GetParentFolderName Method | GetSpecialFolder Method | GetTempName Method
Applies To: FileSystemObject Object