Drive Property

Applies to TestComplete 14.10, last modified on June 5, 2019

Description

The Drive property holds the name of the drive where the folder is located.

Declaration

aqFolderInfoObj.Drive

Read-Only Property String
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

A string containing the drive name.

Example

The code below gets the total size of the drive the specified folder is located on.

JavaScript, JScript

function FolderDriveExample()
{

  // Specifies the path to the desired folder
  var sPath = "C:\\MyFiles\\";
  
  // Obtains the letter of the drive
  var DrvLetter = aqFileSystem.GetFolderInfo(sPath).Drive;
  
  // Gets the drive's total size
  var Size = aqFileSystem.GetDriveInfo(DrvLetter).TotalSize;
    
  // Posts this size to the test log
  Log.Message( IntToStr(Size) );
  
}

Python

def FolderDriveExample():
  # Specifies the path to the desired folder
  sPath = "C:\\MyFiles\\"
  # Obtains the letter of the drive
  DrvLetter = aqFileSystem.GetFolderInfo(sPath).Drive
  # Gets the drive's total size
  Size = aqFileSystem.GetDriveInfo(DrvLetter).TotalSize
  # Posts this size to the test log
  Log.Message(str(Size))

VBScript

Sub FolderDriveExample
  
  ' Specifies the path to the desired folder
  sPath = "C:\MyFiles\"
  
  ' Obtains the letter of the drive
  DrvLetter = aqFileSystem.GetFolderInfo(sPath).Drive
  
  ' Gets the drive's total size
  Size = aqFileSystem.GetDriveInfo(DrvLetter).TotalSize
    
  ' Posts this size to the test log
  Log.Message IntToStr(Size)
  
End Sub

DelphiScript

function FolderDriveExample;
var sPath, DrvLetter, Size;
begin

  // Specifies the path to the desired folder
  sPath := 'C:\MyFiles\';
  
  // Obtains the letter of the drive
  DrvLetter := aqFileSystem.GetFolderInfo(sPath).Drive;
  
  // Gets the drive's total size
  Size := aqFileSystem.GetDriveInfo(DrvLetter).TotalSize;
    
  // Posts this size to the test log
  Log.Message( IntToStr(Size) );
  
end;

C++Script, C#Script

function FolderDriveExample()
{

  // Specifies the path to the desired folder
  var sPath = "C:\\MyFiles\\";
  
  // Obtains the letter of the drive
  var DrvLetter = aqFileSystem["GetFolderInfo"](sPath)["Drive"];
  
  // Gets the drive's total size
  var Size = aqFileSystem["GetDriveInfo"](DrvLetter)["TotalSize"];
    
  // Posts this size to the test log
  Log["Message"]( IntToStr(Size) );
  
}

See Also

Working With Files From Scripts
aqFileSystem.GetFolderInfo Method
Name Property
Path Property

Highlight search results