July 2000
Intermediate to advanced
492 pages
14h 53m
English
GetParentFolderName (FileSystemObject Object) —
fsoObj
.GetFolderName (
strPath
)
Determines the name of the last parent folder in a given path string.
strPath
A string representing the full file path of a given file or folder whose parent folder name you are attempting to retrieve
<%
' Dimension local variables.
Dim fsoObject ' FileSystemObject
' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject(
"Scripting.FileSystemObject")
' Using the GetParentFolderName method, retrieve the
' parent folder names of several path strings.
' This example returns "search" as the parent folder
' name.
Response.Write fsoObject.GetParentFolderName( _
"/apps/search/searchstart.asp")
' This example return "apps" as the parent folder name
Response.Write fsoObject.GetParentFolderName ("/apps/search/")
' This example also returns "apps" as the parent folder
' name.
Response.Write fsoObject.GetParentFolderName ("/apps/search")
' This example returns "nofile" as the parent folder
' name--even though nofile.txt does not exist.
Response.Write fsoObject.GetParentFolderName( _
"/apps/search/nofile.txt")
. . . [additional code]
%>Like the GetBaseName method of the FileSystemObject object, the GetParentFolderName method acts only on the path string itself. The path string argument is not checked for validity or existence.
Read now
Unlock full access