Name
IsRootFolder (Folder Object) —
fdr
.IsRootFolder
Synopsis
A Boolean value that allows you to determine if the current folder is the root folder. This is a read-only property.
Parameters
None
Example
<%
' Dimension local variables.
Dim fsoObject ' FileSystemObject
Dim fdrObject ' Folder Object
' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
"Scripting.FileSystemObject")
' Using the GetFolder method of fsoObject, initialize a
' File object.
Set fdrObject = fsoObject.GetFolder("PublicDocs.txt")
' Determine whether the current folder is a root folder
' or if it is nested.
If fdrObject.IsRootFolder Then
' Folder is located directly off the drive letter
' or share name.
Else
' The folder is nested within at least one other
' folder.
End If
. . . [additional code]
%>
Notes
The Microsoft documentation shows how to use this property to determine to how many levels the current folder is nested. For convenience, the following code demonstrates this:
<% ' Dimension local variables. Dim fsoObject ' FileSystemObject Dim fdrObject ' Folder Object Dim intNestedLevel ' Level to which the folder is nested ' Instantiate the FileSystemObject variable. Set fsoObject = Server.CreateObject( _ "Scripting.FileSystemObject") ' Using the GetFolder method of fsoObject, initialize a ' File object. Set fdrObject = fsoObject.GetFolder("PublicDocs.txt") ' Determine whether the current folder is a root folder ' or if it is nested. If fdrObject.IsRootFolder Then ' Folder is located ...
Get ASP in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.