Property: IsRootFolder for Folder
- Updated2024-09-12
- 1 minute(s) read
FileSystemObject and Dictionary > Properties > Property: IsRootFolder for Folder
Property: IsRootFolder for Folder
Checks whether a folder is the root folder.
Object.IsRootFolder
| Object | Folder Object with this property |
| Object.IsRootFolder | Boolean value with read access The value is TRUE if the folder is the root folder, otherwise the value is FALSE. |
The following example specifies the number of superordinate folders of a folder:
Function CountLevelDepth(sPath) Dim fso, oMyFolder, iCount Set fso = CreateObject("Scripting.FileSystemObject") Set oMyFolder = fso.GetFolder(sPath) iCount = 0 Do While Not oMyFolder.IsRootFolder Set oMyFolder = oMyFolder.ParentFolder iCount = iCount + 1 Loop CountLevelDepth = iCount End Function