FindFiles Method

Applies to TestComplete 15.65, last modified on June 26, 2024
The information below concerns legacy mobile tests that work with mobile devices connected to the local computer. For new mobile tests, we recommend using the newer cloud-compatible approach.


Use the FindFiles method to search the connected Android device or a folder on the Android device for files that match the specified pattern.



ProgObj An expression, variable or parameter that specifies a reference to one of the objects listed in the Applies To section
FileMask [in]    Required    String    
Result An aqObjIterator object

Applies To

The method is applied to the following objects:


The method has the following parameter:


Specifies the mask of the files to search for. A mask can include the * and ? wildcard characters. An asterisk corresponds to a string of any length, a question mark - to any single character.

The mask is case-sensitive.

Result Value

The aqObjIterator objects whose items are AndroidFile objects that store information about the matching files.

To get information on individual files, you can call the iterator’s Next and Item methods and use the properties of the returned AndroidFile object.


The sample code below demonstrates how to search the system/app folder on the connected Android device for all .apk files and posts the names of the found files to the test log:

JavaScript, JScript

function Test()

  var fileSystemManager = Mobile.Device("MyDevice").FileSystemManager;
  var apkFiles = fileSystemManager.FindFiles("system/app/*.apk");

  if (apkFiles.Count > 0)
    while (apkFiles.HasNext())
      var apkFile = apkFiles.Next();

    Log.Warning("No files were found.");



def Test():
  fileSystemManager = Mobile.Device("MyDevice").FileSystemManager
  apkFiles = fileSystemManager.FindFiles("system/app/*.apk")

  if apkFiles.Count > 0:
    while apkFiles.HasNext:
      apkFile = apkFiles.Next
    Log.Warning("No files were found.")


Sub Test

  Set fileSystemManager = Mobile.Device("MyDevice").FileSystemManager
  Set apkFiles = fileSystemManager.FindFiles("system/app/*.apk")

  If apkFiles.Count > 0 Then
    While apkFiles.HasNext
      Set apkFile = apkFiles.Next

    Log.Warning("No files were found.")
  End If

End Sub


procedure Test();
var fileSystemManager, apkFiles, apkFile;

fileSystemManager := Mobile.Device('MyDevice').FileSystemManager;
apkFiles := fileSystemManager.FindFiles('system/app/*.apk');

if apkFiles.Count > 0 then
    while apkFiles.HasNext do
      apkFile := apkFiles.Next;

    Log.Warning('No files were found.');


C++Script, C#Script

function Test()

  var fileSystemManager = Mobile["Device"]("MyDevice")["FileSystemManager"];
  var apkFiles = fileSystemManager["FindFiles"]("system/app/*.apk");

  if (apkFiles["Count"] > 0)
    while (apkFiles["HasNext"]())
      var apkFile = apkFiles["Next"]();

    Log["Warning"]("No files were found.");


See Also

FileSystemManager Object
AndroidFolder Object
aqObjIterator Object
AndroidFile Object
Testing Android Applications (Legacy)

Highlight search results