Name
FileSystemObject.GetExtensionName Method
Syntax
oFileSysObj.GetExtensionName(Path)
oFileSysObjUse: Required
Data Type: FileSystemObject object
A FileSystemObject object.
PathUse: Required
Data Type: String
A path specifier.
Return Value
A String.
Description
Returns the extension of the file element of a given path.
Rules at a Glance
If the extension in Path can’t be
determined, a zero-length string (” “) is returned.
Programming Tips and Gotchas
GetExtensionName is a string parsing method rather than a filesystem method. It does not verify that
Pathis valid, does not verify that the filename designated inPathexists, and does not even guarantee that the value it returns is a valid file extension. In other words, GetExtensionName has no intelligence. It simply parses a string and returns the text that follows the last dot of the last element.Pathcan be a network drive or share.
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