ParentFolder Property

Applies to TestComplete 15.0, last modified on October 19, 2021

Description

The ParentFolder property returns the aqFolderInfoObj object that holds information about the parent folder of the file.

Declaration

aqFileInfoObj.ParentFolder

Read-Only Property An aqFolderInfo object
aqFileInfoObj An expression, variable or parameter that specifies a reference to an aqFileInfo object

Applies To

The property is applied to the following object:

Property Value

An aqFolderInfo object that provides access to file’s parent folder.

Example

The code below obtains information about the specified file's parent folder, gets the folder's size and posts this size to the test log.

JavaScript, JScript

function ParentFolderExample()
{

 // Sets the path to the desired file
 sPath = "C:\\MyFiles\\File.txt";
 
 // Obtains information about the parent folder
 FoldInfo = aqFileSystem.GetFileInfo(sPath).ParentFolder;
 
 // Posts the size of the parent folder to the test log
 Log.Message("The parent folder size is: " + IntToStr(FoldInfo.Size) + " bytes");
 
}

Python

def ParentFolderExample():
  # Sets the path to the desired file
  sPath = "C:\\MyFiles\\File.txt"
  # Obtains information about the parent folder
  FoldInfo = aqFileSystem.GetFileInfo(sPath).ParentFolder
  # Posts the size of the parent folder to the test log
  Log.Message("The parent folder size is: " + IntToStr(FoldInfo.Size) + " bytes")

VBScript

Sub ParentFolderExample

 ' Sets the path to the desired file
 sPath = "C:\MyFiles\File.txt"
 
 ' Obtains information about the parent folder
 Set FoldInfo = aqFileSystem.GetFileInfo(sPath).ParentFolder
 
 ' Posts the size of the parent folder to the test log
 Log.Message("The parent folder size is: " + IntToStr(FoldInfo.Size) + " bytes")
 
End Sub

DelphiScript

function ParentFolderExample;
var sPath, FoldInfo;
begin

 // Sets the path to the desired file
 sPath := 'C:\MyFiles\File.txt';
 
 // Obtains information about the parent folder
 FoldInfo := aqFileSystem.GetFileInfo(sPath).ParentFolder;
 
 // Posts the size of the parent folder to the test log
 Log.Message('The parent folder size is: ' + IntToStr(FoldInfo.Size) + ' bytes');
 
end;

C++Script, C#Script

function ParentFolderExample()
{

 // Sets the path to the desired file
 sPath = "C:\\MyFiles\\File.txt";
 
 // Obtains information about the parent folder
 FoldInfo = aqFileSystem["GetFileInfo"](sPath)["ParentFolder"];
 
 // Posts the size of the parent folder to the test log
 Log["Message"]("The parent folder size is: " + IntToStr( FoldInfo["Size"] ) + " bytes");
 
}

See Also

Working With Files From Scripts
GetFileInfo Method
FindFiles Method
Name Property
Path Property
Drive Property

Highlight search results