Folders Property

Applies to TestComplete 15.70, last modified on December 17, 2024

Description

Use the aqDriveInfo.Folders property to get access to drive folders.

Declaration

aqDriveInfoObj.Folders

Read-Only Property The aqObjIterator object
aqDriveInfoObj An expression, variable or parameter that specifies a reference to an aqDriveInfo object

Applies To

The property is applied to the following object:

Property Value

An aqObjIterator object whose items are aqFolderInfo objects that correspond to folders of the specified drive. If the specified drive does not contain any folders, the property returns an empty value (null in JavaScript, JScript, C#Script and C++Script, None in Python, Nothing in VBScript, nil in DelphiScript).

Example

The code below demonstrates how to obtain the number of a drive's folders.

JavaScript

function CalculatingRootFoldersNumber()
{
  // Specifies the desired drive
  let Drive = "C";

  // Obtains a collection of folders stored on the specified drive
  let colFolders = aqFileSystem.GetDriveInfo(Drive).Folders;

  // Checks whether the collection is empty
  if (!strictEqual(colFolders, null))

    // Posts the total number of the drive's root folders to the log
    Log.Message(colFolders.Count);
  else
    Log.Message("The " + Drive + " drive contains no folders");
}

JScript

function CalculatingRootFoldersNumber()
{
  // Specifies the desired drive
  var Drive = "C";

  // Obtains a collection of folders stored on the specified drive
  var colFolders = aqFileSystem.GetDriveInfo(Drive).Folders;

  // Checks whether the collection is empty
  if (colFolders != null)

    // Posts the total number of the drive's root folders to the log
    Log.Message(colFolders.Count);
  else
    Log.Message("The " + Drive + " drive contains no folders");
}

Python

def CalculatingRootFoldersNumber():
  # Specifies the desired drive
  Drive = "C"
  # Obtains a collection of folders stored on the specified drive
  colFolders = aqFileSystem.GetDriveInfo(Drive).Folders
  # Checks whether the collection is empty
  if colFolders != None:
    # Posts the total number of the drive's root folders to the log
    Log.Message(colFolders.Count)
  else:
    Log.Message("The " + Drive + " drive contains no folders")

VBScript

Sub CalculatingRootFoldersNumber

  Dim Drive, colFolders
  ' Specifies the desired drive
  Drive = "C"

  ' Obtains a collection of folders stored on the specified drive
  Set colFolders = aqFileSystem.GetDriveInfo(Drive).Folders

  ' Checks whether the collection is empty
  If Not colFolders Is Nothing Then

    ' Posts the total number of the drive's root folders to the log
    Log.Message(colFolders.Count)
  Else
    Log.Message("The " & Drive & " drive contains no folders")
  End If

End Sub

DelphiScript

procedure CalculatingRootFoldersNumber();
var Drive, colFolders;
begin
  // Specifies the desired drive
  Drive := 'C';

  // Obtains a collection of folders stored on the specified drive
  colFolders := aqFileSystem.GetDriveInfo(Drive).Folders;

  // Checks whether the collection is empty
  if colFolders <> nil then

    // Posts the total number of the drive's root folders to the log
    Log.Message(colFolders.Count)
  else
    Log.Message('The ' + Drive + ' drive contains no folders');
end;

C++Script, C#Script

function CalculatingRootFoldersNumber()
{
  // Specifies the desired drive
  var Drive = "C";

  // Obtains a collection of folders stored on the specified drive
  var colFolders = aqFileSystem["GetDriveInfo"](Drive)["Folders"];

  // Checks whether the collection is empty
  if (colFolders != null)

    // Posts the total number of the drive's root folders to the log
    Log["Message"](colFolders["Count"]);
  else
    Log["Message"]("The " + Drive + " drive contains no folders");
}

See Also

aqFileSystem Object
aqFolderInfo Object

Highlight search results