aqFileSystem.GetDriveInfo Method

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

The GetDriveInfo method returns an aqDriveInfo object that stores detailed information about the given drive: total and available disk space, drive type, serial number and so on.

Declaration

aqFileSystem.GetDriveInfo(Drive)

Drive [in]    Required    String    
Result The aqDriveInfo object.

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

Drive

Specifies the desired disk, for example "C:\" or "\\JohnSmith\Shared Files" ("C:\\" and "\\\\JohnSmith\\SharedFiles" for JavaScript, JScript, Python, C++Script and C#Script).

Result Value

The aqDriveInfo object that stores complete information about the given disk.

Example

The code below demonstrates how to obtain the total number of files located in a drive's root folder.

JavaScript, JScript

function CalculatingRootFilesNumber()
{
  // Obtains a file collection
  var F = aqFileSystem.GetDriveInfo("C").Files;
  // Posts the total number of the drive's root files to the log
  Log.Message(F.Count);
}

Python

def CalculatingRootFilesNumber():
  # Obtains a file collection
  F = aqFileSystem.GetDriveInfo("C").Files
  # Posts the total number of the drive's root files to the log
  Log.Message(F.Count)

VBScript

sub CalculatingRootFilesNumber
Dim F
  ' Obtains a file collection
  Set F = aqFileSystem.GetDriveInfo("C").Files
  ' Posts the total number of the drive's root files to the log
  Log.Message(F.Count)
end sub

DelphiScript

function CalculatingRootFilesNumber;
var F: OleVariant;
begin
  // Obtains a file collection
  F := aqFileSystem.GetDriveInfo('C').Files;
  // Posts the total number of the drive's root files to the log
  Log.Message(F.Count);
end;

C++Script, C#Script

function CalculatingRootFilesNumber()
{
  // Obtains a file collection
  var F = aqFileSystem["GetDriveInfo"]("C")["Files"];
  // Posts the total number of the drive's root files to the log
  Log["Message"]( F["Count"] );
}

See Also

Working With Files From Scripts
aqDriveInfo Object

Highlight search results