CreateFolder Method

Applies to TestComplete 15.70, last modified on December 17, 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.

Description

Use the CreateFolder method to create a folder at the specified location on the connected Android device.

Declaration

FileSystemManagerObj.CreateFolder(Path)

FileSystemManagerObj An expression, variable or parameter that specifies a reference to a FileSystemManager object
Path [in]    Required    String    
Result Boolean

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

Path

Specifies the name (with the full path) of the new folder you want to create on the device. Case-sensitive.

Result Value

True if the folder has been created successfully; False otherwise.

Example

The sample code below demonstrates how to use the method to create a folder on the connected Android device:

JavaScript, JScript

function Test()
{
  var fileSystemManager = Mobile.Device("MyDevice").FileSystemManager;
  var sFolder = "system/app/test";

  // Creates a folder and checks if it has been created successfully
  if (! fileSystemManager.CreateFolder(sFolder))
    Log.Error("Could not create the " + sFolder + " folder");
}

Python

def Test():
  fileSystemManager = Mobile.Device("MyDevice").FileSystemManager
  sFolder = "system/app/test"

  # Creates a folder and checks if it has been created successfully
  if not fileSystemManager.CreateFolder(sFolder):
    Log.Error("Could not create the " + sFolder + " folder")

VBScript

Sub Test
  Set fileSystemManager = Mobile.Device("MyDevice").FileSystemManager
  sFolder = "system/app/test"

  ' Creates a folder and checks if it has been created successfully
  If Not fileSystemManager.CreateFolder(sFolder) Then
    Log.Error("Could not create the " + sFolder + " folder")
  End If
End Sub

DelphiScript

procedure Test();
var fileSystemManager, sFolder;
begin
  fileSystemManager := Mobile.Device('MyDevice').FileSystemManager;
  sFolder := 'system/app/test';

  // Creates a folder and checks if it has been created successfully
  if not fileSystemManager.CreateFolder(sFolder) then
    Log.Error('Could not create the ' + sFolder + ' folder');
end;

C++Script, C#Script

function Test()
{
  var fileSystemManager = Mobile["Device"]("MyDevice")["FileSystemManager"];
  var sFolder = "system/app/test";

  // Creates a folder and checks if it has been created successfully
  if (! fileSystemManager["CreateFolder"](sFolder))
    Log["Error"]("Could not create the " + sFolder + " folder");
}

See Also

FileSystemManager Object
Testing Android Applications (Legacy)

Highlight search results