Path Property

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

Description

The Path property holds the full path to the underlying folder.

Declaration

aqFolderInfoObj.Path

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 fully-qualified path to the folder.

Example

The code below obtains the collection of subfolders of the C:\MyFiles folder and posts the paths to these subfolders to the test log.

JavaScript, JScript

function SubFoldersFinder()
{

  // Obtains information about the folder
  var FolInfo = aqFileSystem.GetFolderInfo("C:\\MyFiles");
  
  // Obtains the total number of the specified folder's subfolders
  var Num = FolInfo.SubFolders.Count;
  
  var SubFol = FolInfo.SubFolders;
    
  // Posts the paths to the subfolders to the test log
  Log.Message("The MyFiles folder contains the following subfolders:");
  
  if (Num != 0)
  
    while (SubFol.HasNext())
    {
       // Obtains the current subfolder
       var FolItem = SubFol.Next();
       // Posts the subfolder's name to the test log
       Log.Message(FolItem.Path)
    }
    
  else
    Log.Message("The specified folder does not contain any subfolders.");
  
}

Python

def SubFoldersFinder():
  # Obtains information about the folder
  FolInfo = aqFileSystem.GetFolderInfo("C:\\MyFiles")
  # Obtains the total number of the specified folder's subfolders
  Num = FolInfo.SubFolders.Count
  SubFol = FolInfo.SubFolders
  # Posts the paths to the subfolders to the test log
  Log.Message("The MyFiles folder contains the following subfolders:")
  if Num != 0:
    while SubFol.HasNext():
      # Obtains the current subfolder
      FolItem = SubFol.Next()
      # Posts the subfolder's name to the test log
      Log.Message(FolItem.Path)
  else:
    Log.Message("The specified folder does not contain any subfolders.")

VBScript

Sub SubFoldersFinder

  ' Obtains information about the folder
  Set FolInfo = aqFileSystem.GetFolderInfo("C:\MyFiles")
  
  ' Obtains the total number of the specified folder's subfolders
  Num = FolInfo.SubFolders.Count
  
  Set SubFol = FolInfo.SubFolders
    
  ' Posts the paths to the subfolders to the test log
  Log.Message("The MyFiles folder contains the following subfolders:")
  
  If Not (Num = 0) Then
  
    While SubFol.HasNext
       ' Obtains the current subfolder
       Set FolItem = SubFol.Next
       ' Posts the subfolder's name to the test log
       Log.Message(FolItem.Path)
    WEnd
    
  Else
    Log.Message("The specified folder does not contain any subfolders.")
  End If
  
End Sub

DelphiScript

function SubFoldersFinder;
var FolInfo, Num, SubFol, FolItem;
begin

  // Obtains information about the folder
  FolInfo := aqFileSystem.GetFolderInfo('C:\MyFiles');
  
  // Obtains the total number of the specified folder's subfolders
  Num := FolInfo.SubFolders.Count;
  
  SubFol := FolInfo.SubFolders;
    
  // Posts the paths to the subfolders to the test log
  Log.Message('The MyFiles folder contains the following subfolders:');
  
  if (Num <> 0) then
  
    while (SubFol.HasNext()) do
    begin
       // Obtains the current subfolder
       FolItem := SubFol.Next;
       // Posts the subfolder's name to the test log
       Log.Message(FolItem.Path)
    end
    
  else
    Log.Message('The specified folder does not contain any subfolders.');
  
end;

C++Script, C#Script

function SubFoldersFinder()
{

  // Obtains information about the folder
  var FolInfo = aqFileSystem["GetFolderInfo"]( "C:\\MyFiles" );
  
  // Obtains the total number of the specified folder's subfolders
  var Num = FolInfo["SubFolders"]["Count"];
  
  var SubFol = FolInfo["SubFolders"];
    
  // Posts the paths to the subfolders to the test log
  Log["Message"]( "The MyFiles folder contains the following subfolders:" );
  
  if (Num != 0)
  
    while (SubFol["HasNext"]())
    {
       // Obtains the current subfolder
       var FolItem = SubFol["Next"]();
       // Posts the subfolder's name to the test log
       Log["Message"]( FolItem["Path"] )
    }
    
  else
    Log["Message"]( "The specified folder does not contain any subfolders." );
  
}

See Also

Working With Files From Scripts
GetFolderInfo Method
Name Property
ShortPath Property

Highlight search results