Name
FileSystemObject.GetAbsolutePathName Method
Syntax
oFileSysObj.GetAbsolutePathName(Path)
oFileSysObjUse: Required
Data Type: FileSystemObject object
A FileSystemObject object.
PathUse: Required
Data Type: String
A path specifier.
Return Value
A string containing the absolute path of a given path specifier.
Description
Converts a relative path to a fully qualified path, including the drive letter.
Rules at a Glance
(.)returns the drive letter and complete path of the current folder.(
..) returns the drive letter and path of the parent of the current folder.IfPathis simply a filename without a path, the method concatenates the complete path to the current directory with the filename. For example, if the current folder is C:\Documents\MyScripts, then the method call:sFileName = GetAbsolutePathName("MyFile.txt")produces the string “C:\Documents\MyScripts\MyFile.txt”.
All relative pathnames are assumed to originate at the current folder. This means, for example, that
(.)returns the drive letter and complete path of the current folder, and that(..)returns the drive letter and path of the parent of the current folder.If a drive isn’t explicitly provided as part of
Path, it’s assumed to be the current drive.Wildcard characters can be included in
Pathat any point.
Programming Tips and Gotchas
An absolute path provides a complete route from the root directory of a particular drive to a particular folder or file. In contrast, a relative path describes a route from the current folder to a particular ...
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