GetFileName method
Returns the last file or folder of the specified path (not the specified drive path part).
object.GetFileName(pathspec)
parameter
object
Required option. Should be the name of FileSystemObject.
pathspec
Required option. Specifies the path (absolute or relative path) of the file.
illustrate
ifpathspecInstead of ending with a named file or folder,GetFileNameThe method returns a zero-length string (""). The following example shows how to use itGetFileNamemethod:
The following examples are givenGetFileNameUsage of the method:
Function GetAName(DriveSpec) Dim fso Set fso = CreateObject("") GetAName = (DriveSpec)End Function
Note: GetFileNameMethods can only be providedpathThe string of . It cannot attempt to analyze a path, nor can it check if the specified path exists.