| FileSystemObject.GetBaseName Method (VB6) |
Named Arguments
Yes
Syntax
oFileSysObj.GetBaseName(Path)
oFileSysObj
Use: Required
Data Type: FileSystemObject object
Any object variable returning a FileSystemObject object.
Path
Use: Required
Data Type: String
A path specifier.
Return Value
A string containing the last element in Path.
Description
Returns the name of the last path component, less any extension.
Rules at a Glance
The file extension of the last element in Path isn't included in the returned string.
Programming Tips and Gotchas
GetBaseName doesn't verify that a given file or folder exists in Path.
In stripping the "file extension" and returning the base name of Path, GetBaseName has no intelligence. That is, it doesn't know whether the last component of Path is a path or a filename. If the last component includes one or more dots, it simply removes the last one, along with any following text. Hence, GetBaseName returns a null string for a Path of "." and it returns "." for a Path of "..". It is, in other words, really a string manipulation function, rather than a file function.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access