O'Reilly logo

VBScript in a Nutshell, 2nd Edition by Ron Petrusha, Matt Childs, Paul Lomax

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

FileSystemObject.BuildPath Method

Syntax

                  oFileSysObj.BuildPath(Path, Name)
oFileSysObj

Use: Required

Data Type: FileSystemObject object

A FileSystemObject object.

Path

Use: Required

Data Type: String

A drive and/or folder path.

Name

Use: Required

Data Type: String

The folder or file path to append to path.

Return Value

A String.

Description

Creates a single string representing a path and filename or simply a path by concatenating the path parameter with the folder or filename, adding, where required, the correct path separator for the host system.

Rules at a Glance

  • Path can be an absolute or relative path and doesn’t have to include the drive name.

  • Neither Path nor Name has to currently exist.

Programming Tips and Gotchas

  • BuildPath is really a string concatenation method rather than a filesystem method; it does not check the validity of the new folder or filename. If you intend that the method’s return value be a path, you should check it by passing it to the FolderExists method; if you intend that the method’s return value be a path and filename, you should verify it by passing it to the FileExists method.

  • The only advantage to using the BuildPath function as opposed to concatenating two strings manually is that the function selects the correct path separator.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required