IsRootFolder Property

Applies to TestComplete 14.72, last modified on December 24, 2020

Description

The IsRootFolder property indicates whether the given folder is a root folder.

Declaration

aqFolderInfoObj.IsRootFolder

Read-Only Property Boolean
aqFolderInfoObj An expression, variable or parameter that specifies a reference to an aqFolderInfo object

Applies To

The property is applied to the following object:

Property Value

True if the given folder is a root folder, and False otherwise.

Example

The code below searches for non-root TXT files located on the C:\ drive.

JavaScript, JScript

function FileFinder()
{

  // Specifies the search condition
  var foundFiles = aqFileSystem.FindFiles("C:\\MyFiles\\", "*.txt", true);
  
  // Posts the names of non-root TXT files to the test log
  for (var i = 0; i < foundFiles.Count; i++)
     if ( (foundFiles.HasNext()) & (! foundFiles.Item(i).ParentFolder.IsRootFolder) )
     {
       var aFile = foundFiles.Next();
       Log.Message(aFile.Name);
     }
  
}

Python

def FileFinder():
  # Specifies the search condition
  foundFiles = aqFileSystem.FindFiles("C:\\MyFiles\\", "*.txt", True)
  # Posts the names of non-root TXT files to the test log
  for i in range(0, foundFiles.Count):
    if foundFiles.HasNext() and not foundFiles.Item(i).ParentFolder.IsRootFolder:
      aFile = foundFiles.Next()
      Log.Message(aFile.Name)

VBScript

Sub FileFinder

  ' Specifies the search condition
  Set foundFiles = aqFileSystem.FindFiles("C:\MyFiles\", "*.txt", true)
  
  ' Posts the names of non-root TXT files to the test log
  For i = 0 to foundFiles.Count-1
     If (foundFiles.HasNext) and (not foundFiles.Item(i).ParentFolder.IsRootFolder) Then
       Set aFile = foundFiles.Next
       Log.Message aFile.Name
     End If
  Next
  
End Sub

DelphiScript

function FileFinder;
var foundFiles, i, aFile;
begin

  // Specifies the search condition
  foundFiles := aqFileSystem.FindFiles('C:\MyFiles\', '*.txt', true);
  
  // Posts the names of non-root TXT files to the test log
  for i := 0 to (foundFiles.Count-1) do
     if ((foundFiles.HasNext()) and (not foundFiles.Item(i).ParentFolder.IsRootFolder)) then
     begin
       aFile := foundFiles.Next();
       Log.Message(aFile.Name);
     end;
end;

C++Script, C#Script

function FileFinder()
{

  // Specifies the search condition
  var foundFiles = aqFileSystem["FindFiles"]("C:\\MyFiles\\", "*.txt", true);
  
  // Posts the names of non-root TXT files to the test log
  for (var i = 0; i < foundFiles["Count"]; i++)
     if ( (foundFiles["HasNext"]()) & (! foundFiles["Item"](i)["ParentFolder"]["IsRootFolder"] ) )
     {
       var aFile = foundFiles["Next"]();
       Log["Message"]( aFile["Name"] );
     }
  
}

See Also

Working With Files From Scripts
GetFolderInfo Method

Highlight search results