Name Property

Applies to TestComplete 14.60, last modified on April 22, 2021

Description

The Name property returns the name of the folder (without the path) specified by the given aqFolderInfoObj object.

Declaration

aqFolderInfoObj.Name

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 name of the folder (without the folder’s path).

Example

The code below obtains the collection of all the root folders of the specified drive and posts the folders' names to the test log.

JavaScript, JScript

function FolderNameExample()
{
 // Sets the path to the desired drive
 DrvPath = "C:\\";
 
 // Gets the total number of the folders located on the drive
 var FoldersNum = aqFileSystem.GetFolderInfo(DrvPath).SubFolders.Count;
 
 var FolderItems = aqFileSystem.GetFolderInfo(DrvPath).SubFolders;
 
 // Posts the names of all the root folders located on the drive to the test log
 for (var i = 0; i < FoldersNum; i++)
  Log.Message(FolderItems.Item(i).Name)
 
}

Python

def FolderNameExample():
  # Sets the path to the desired drive
  DrvPath = "C:\\"
  # Gets the total number of the folders located on the drive
  FoldersNum = aqFileSystem.GetFolderInfo(DrvPath).SubFolders.Count
  FolderItems = aqFileSystem.GetFolderInfo(DrvPath).SubFolders
  # Posts the names of all the root folders located on the drive to the test log
  for i in range(0, FoldersNum):
    Log.Message(FolderItems.Item(i).Name)

VBScript

Sub FolderNameExample

 ' Sets the path to the desired drive
 DrvPath = "C:\"
 
 ' Gets the total number of the folders located on the drive
 FoldersNum = aqFileSystem.GetFolderInfo(DrvPath).SubFolders.Count
 
 Set FolderItems = aqFileSystem.GetFolderInfo(DrvPath).SubFolders
 
 ' Posts the names of all the root folders located on the drive to the test log
 For i = 0 to FoldersNum-1
  Call Log.Message(FolderItems.Item(i).Name)
 Next
 
End Sub

DelphiScript

function FolderNameExample;
var DrvPath, FoldersNum, FolderItems, i;
begin

 // Sets the path to the desired drive
 DrvPath := 'C:\';
 
 // Gets the total number of the folders located on the drive
 FoldersNum := aqFileSystem.GetFolderInfo(DrvPath).SubFolders.Count;
 
 FolderItems := aqFileSystem.GetFolderInfo(DrvPath).SubFolders;
 
 // Posts the names of all the root folders located on the drive to the test log
 For i := 0 to (FoldersNum - 1) do
  Log.Message(FolderItems.Item(i).Name);
 
end;

C++Script, C#Script

function FolderNameExample()
{

 // Sets the path to the desired folder
 DrvPath = "C:\\";
 
 // Gets the total number of the folders located on the drive
 var FoldersNum = aqFileSystem["GetFolderInfo"](DrvPath)["SubFolders"]["Count"];
 
 var FolderItems = aqFileSystem["GetFolderInfo"](DrvPath)["SubFolders"];
 
 // Posts the names of all the root folders located on the drive to the test log
 for (var i = 0; i<FoldersNum; i++)
  Log["Message"]( FolderItems["Item"](i)["Name"] )
 
}

See Also

Working With Files From Scripts
GetFolderInfo Method
Path Property
Drive Property

Highlight search results