如果指定的文件夾是根文件夾則返回 True ;否則返回 False 。
object.IsRootFolder
object 應為 Folder 對象。
下面的代碼說明了 IsRootFolder 屬性的用法:
[JScript] function DisplayLevelDepth(pathspec) { var fso, f, n, s = ""; fso = new ActiveXObject("Scripting.FileSystemObject"); f = fso.GetFolder(pathspec); n = 0; if (f.IsRootFolder) s = "The specified folder is the root folder." else { do { f = f.ParentFolder; n++; } while (!f.IsRootFolder
) s = "The specified folder is nested " + n + " levels deep." } return(s); } [VBScript] Function DisplayLevelDepth(pathspec) Dim fso, f, n Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFolder(pathspec) If f.IsRootFolder Then DisplayLevelDepth = "The specified folder is the root folder." Else Do Untilf.IsRootFolder
Set f = f.ParentFolder n = n + 1 Loop DisplayLevelDepth = "The specified folder is nested " & n & " levels deep." End If End Function
Attributes 屬性 | DateCreated 屬性 | DateLastAccessed 屬性 | DateLastModified 屬性 | Drive 屬性 | Files 屬性 | Name 屬性 | ParentFolder 屬性 | Path 屬性 | ShortName 屬性 | ShortPath 屬性 | Size 屬性 | SubFolders 屬性 | Type 屬性
應用于:Folder 對象