Path Property

Applies to TestComplete 15.0, last modified on November 17, 2021

Description

The Path property holds the fully-qualified path to the file with the file’s name and extension.

Declaration

aqFileInfoObj.Path

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

A string containing the fully-qualified path to the file (with the file’s name and extension).

Example

The code below obtains the collection of text files located in the C:\MyFiles folder and then posts the paths to these files to the test log.

JavaScript

function FilePath()
{
  let foundFiles = aqFileSystem.FindFiles("C:\\MyFiles\\", "*.txt", true);
  
  if ( !strictEqual(foundFiles.Count, null) )
  {
     while (foundFiles.HasNext())
     {
       let aFile = foundFiles.Next();
       Log.Message(aFile.Path);
     }
  }
  else
      Log.Message("No files were found.");
}

JScript

function FilePath()
{
  var foundFiles = aqFileSystem.FindFiles("C:\\MyFiles\\", "*.txt", true);
  
  if ( foundFiles.Count != null)
  {
     while (foundFiles.HasNext())
     {
       var aFile = foundFiles.Next();
       Log.Message(aFile.Path);
     }
  }
  else
      Log.Message("No files were found.");
}

Python

def FilePath():
  foundFiles = aqFileSystem.FindFiles("C:\\ExampleFolder\\", "*.txt", True)
  if foundFiles != None:
    while foundFiles.HasNext():
      aFile = foundFiles.Next()
      Log.Message(aFile.Path)
  else:
    Log.Message("No files were found.")

VBScript

Sub FilePath
  Set foundFiles = aqFileSystem.FindFiles("C:\MyFiles\", "*.txt", true)
  
  If Not foundFiles Is Nothing Then
  
     While foundFiles.HasNext
       Set aFile = foundFiles.Next
       Log.Message aFile.Path
     Wend
     
  Else
      Log.Message "No files were found."
  End If
  
End Sub

DelphiScript

function FilePath;
var foundFiles, aFile;
begin

  foundFiles := aqFileSystem.FindFiles('C:\MyFiles\', '*.txt', true);
  
  If ( foundFiles.Count <> Nil) Then

     While (foundFiles.HasNext)do
     begin
       aFile := foundFiles.Next;
       Log.Message(aFile.Path);
     end
  else
      Log.Message('No files were found.');
   
end;

C++Script, C#Script

function FilePath()
{
  var foundFiles = aqFileSystem["FindFiles"]("C:\\MyFiles\\", "*.txt", true);
  
  if ( foundFiles["Count"] != null)
  {
     while (foundFiles["HasNext"]())
     {
       var aFile = foundFiles["Next"]();
       Log["Message"]( aFile["Path"] );
     }
  }
  else
      Log["Message"]("No files were found.");
}

See Also

Working With Files From Scripts
GetFileInfo Method
FindFiles Method
Name Property
ShortPath Property

Highlight search results