Description
Use the FindFolders
method to search the connected Android device or a folder on the Android device for subfolders that match the specified pattern.
Declaration
ProgObj.FindFolders(FolderMask)
ProgObj | An expression, variable or parameter that specifies a reference to one of the objects listed in the Applies To section | |||
FolderMask | [in] | Required | String | |
Result | An aqObjIterator object |
Applies To
The method is applied to the following objects:
Parameters
The method has the following parameter:
FolderMask
Specifies the mask of the folders 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 AndroidFolder
objects that store information about the matching folders.
To get information on individual folders, you can call the iterator’s Next
and Item
method and use the properties of the returned AndroidFolder
object.
Example
The sample code below demonstrates how to use the method to search the connected device for folders that contain the word sys in their name:
JavaScript, JScript
function Test()
{
var fileSystemManager = Mobile.Device("MyDevice").FileSystemManager;
var folders = fileSystemManager.FindFolders("*sys*");
if (folders.Count > 0)
{
while (folders.HasNext())
{
var folder = folders.Next();
Log.Message(folder.Name);
}
}
else
Log.Warning("No folders were found.");
}
Python
def Test():
fileSystemManager = Mobile.Device("MyDevice").FileSystemManager
folders = fileSystemManager.FindFolders("*sys*")
if folders.Count > 0:
while folders.HasNext:
folder = folders.Next
Log.Message(folder.Name)
else:
Log.Warning("No folders were found.")
VBScript
Sub Test
Set fileSystemManager = Mobile.Device("MyDevice").FileSystemManager
Set folders = fileSystemManager.FindFolders("*sys*")
If folders.Count > 0 Then
While folders.HasNext
Set folder = folders.Next
Log.Message(folder.Name)
Wend
Else
Log.Warning("No folders were found.")
End If
End Sub
DelphiScript
procedure Test();
var fileSystemManager, folders, folder;
begin
fileSystemManager := Mobile.Device('MyDevice').FileSystemManager;
folders := fileSystemManager.FindFolders('*sys*');
if folders.Count > 0 then
begin
while folders.HasNext do
begin
folder := folders.Next;
Log.Message(folder.Name);
end;
end
else
Log.Warning('No folders were found.');
end;
C++Script, C#Script
function Test()
{
var fileSystemManager = Mobile["Device"]("MyDevice")["FileSystemManager"];
var folders = fileSystemManager["FindFolders"]("*sys*");
if (folders["Count"] > 0)
{
while (folders["HasNext"]())
{
var folder = folders["Next"]();
Log["Message"](folder["Name"]);
}
}
else
Log["Warning"]("No folders were found.");
}
See Also
FileSystemManager Object
AndroidFolder Object
aqObjIterator Object
Testing Android Applications