Description
The aqFolderInfo
object provides detailed information about a folder. The objects of this type are returned by aqFileSystem.GetFolderInfo
, aqFileSystem.FindFolders
, aqFileInfo.ParentFolder
, aqFolderInfo.ParentFolder
and some other methods and properties of common scripting objects.
Members
Example
The code below posts the names of all subfolders of the C:\MyFiles folder to the test log.
JavaScript
function SubFoldersFinder()
{
// Specifies the path to the desired folder
var sPath = "C:\\MyFolder";
// Obtains information about the folder
let FolInfo = aqFileSystem.GetFolderInfo(sPath);
// Obtains the collection of subfolders
let colSubFolders = FolInfo.SubFolders;
// Checks whether the collection is empty
if (!strictEqual(colSubFolders, null))
{
// Posts the names of the folder's subfolders to the test log
Log.AppendFolder("The " + sPath + " folder contains the following subfolders:");
while (colSubFolders.HasNext())
{
// Obtains the current subfolder
let FolItem = colSubFolders.Next();
// Posts the subfolder's name to the test log
Log.Message(FolItem.Name);
}
Log.PopLogFolder();
}
else
Log.Message("The specified folder does not contain any subfolders.");
}
JScript
function SubFoldersFinder()
{
// Specifies the path to the desired folder
var sPath = "C:\\MyFolder";
// Obtains information about the folder
var FolInfo = aqFileSystem.GetFolderInfo(sPath);
// Obtains the collection of subfolders
var colSubFolders = FolInfo.SubFolders;
// Checks whether the collection is empty
if (colSubFolders != null)
{
// Posts the names of the folder's subfolders to the test log
Log.AppendFolder("The " + sPath + " folder contains the following subfolders:");
while (colSubFolders.HasNext())
{
// Obtains the current subfolder
var FolItem = colSubFolders.Next();
// Posts the subfolder's name to the test log
Log.Message(FolItem.Name);
}
Log.PopLogFolder();
}
else
Log.Message("The specified folder does not contain any subfolders.");
}
Python
def SubFoldersFinder():
# Specifies the path to the desired folder
sPath = "C:\\MyFolder"
# Obtains information about the folder
FolInfo = aqFileSystem.GetFolderInfo(sPath)
# Obtains the collection of subfolders
colSubFolders = FolInfo.SubFolders
# Checks whether the collection is empty
if colSubFolders != None:
# Posts the names of the folder's subfolders to the test log
Log.AppendFolder("The " + sPath + " folder contains the following subfolders:")
while colSubFolders.HasNext():
# Obtains the current subfolder
FolItem = colSubFolders.Next()
# Posts the subfolder's name to the test log
Log.Message(FolItem.Name)
Log.PopLogFolder()
else:
Log.Message("The specified folder does not contain any subfolders.")
VBScript
Sub SubFoldersFinder
' Specifies the path to the desired folder
sPath = "C:\MyFolder"
' Obtains information about the folder
Set FolInfo = aqFileSystem.GetFolderInfo(sPath)
' Obtains the collection of subfolders
Set colSubFolders = FolInfo.SubFolders
' Checks whether the collection is empty
If Not colSubFolders Is Nothing Then
' Posts the names of the folder's subfolders to the test log
Log.AppendFolder("The " & sPath & " folder contains the following subfolders:")
While colSubFolders.HasNext
' Obtains the current subfolder
Set FolItem = colSubFolders.Next
' Posts the subfolder's name to the test log
Log.Message(FolItem.Name)
WEnd
Log.PopLogFolder
Else
Log.Message("The specified folder does not contain any subfolders.")
End If
End Sub
DelphiScript
procedure SubFoldersFinder();
var sPath, FolInfo, colSubFolders, FolItem;
begin
// Specifies the path to the desired folder
sPath := 'C:\MyFolder';
// Obtains information about the folder
FolInfo := aqFileSystem.GetFolderInfo(sPath);
// Obtains the collection of subfolders
colSubFolders := FolInfo.SubFolders;
// Checks whether the collection is empty
if colSubFolders <> nil then
begin
// Posts the names of the folder's subfolders to the test log
Log.AppendFolder('The ' + sPath + ' folder contains the following subfolders:');
while colSubFolders.HasNext do
begin
// Obtains the current subfolder
FolItem := colSubFolders.Next;
// Posts the subfolder's name to the test log
Log.Message(FolItem.Name);
end;
Log.PopLogFolder;
end
else
Log.Message('The specified folder does not contain any subfolders.');
end;
C++Script, C#Script
function SubFoldersFinder()
{
// Specifies the path to the desired folder
var sPath = "C:\\MyFolder";
// Obtains information about the folder
var FolInfo = aqFileSystem["GetFolderInfo"](sPath);
// Obtains the collection of subfolders
var colSubFolders = FolInfo["SubFolders"];
// Checks whether the collection is empty
if (colSubFolders != null)
{
// Posts the names of the folder's subfolders to the test log
Log["AppendFolder"]("The " + sPath + " folder contains the following subfolders:");
while (colSubFolders["HasNext"]())
{
// Obtains the current subfolder
var FolItem = colSubFolders["Next"]();
// Posts the subfolder's name to the test log
Log["Message"](FolItem.Name);
}
Log["PopLogFolder"]();
}
else
Log["Message"]("The specified folder does not contain any subfolders.");
}
See Also
Working With Files From Scripts
GetFolderInfo Method
ParentFolder Property
ParentFolder Property