Skip to content

Create a Directory

Description

This operation allows creating a directory and subdirectories in the Backendless. You can create any number of subdirectories in one request.

The following symbols are forbidden in the directory name:

Name
Symbol
One dot and a forward slash.
./
Two dots and one forward slash.
../
One dot.
.
Two dots.
..
Single quotation mark.
'
Double quotation mark.
"
Less-than sign.
<
Greater-than sign.
>
Percent sign.
%

Method

Blocking API

public void Backendless.Files.createDirectory( path )

Non-Blocking API

public void Backendless.Files.createDirectory( path, AsyncCallback<Void> responder )

where:

Argument                Description
path String value. Specify the path where a directory must be created, for instance the "/TestDirectory/TestSubDirectory/" creates two directories, where the "TestDirectory" is the main directory that is created in the root folder of the Backendless, and the "TestSubDirectory" is the subdirectory created in the "TestDirectory". You can create any number of subdirectories in one request.
responder A responder object which receives a callback when the method successfully completes or if an error occurs.

Return Value

None.

Example

The example below creates a new directory called "TestDir" and the subdirectory "SubTestDir".

Blocking API

Backendless.Files.createDirectory( "/TestDir/SubTestDir" );

Non-Blocking API

Backendless.Files.createDirectory( "/TestDir/SubTestDir", new AsyncCallback<Void>()
{
  @Override
  public void handleResponse( Void response )
  {
    // result handling logic
  }

  @Override
  public void handleFault( BackendlessFault fault )
  {
    // error handling logic
  }
} );

Codeless Reference

file_codeless_create_directory

where:

Argument                Description
directory path Specify the path where a directory it must be created, for instance the "/TestDirectory/TestSubDirectory/" creates two directories, where the "TestDirectory" is the main directory that is created in the root folder of the Backendless, and the "TestSubDirectory" is the subdirectory created in the "TestDirectory". You can create any number of subdirectories in one request.

The example below creates the new directory called "TestDir" and the subdirectory "SubTestDir".

file_codeless_create_directory_2

The output will look as shown below after the Codeless logic runs:

file_codeless_create_directory_3