Skip to content

Deleting a Directory

To delete a directory from the Backendless file storage, it must be identified by the its path. Directories in the Backendless storage have the following URL structure:

https://api.backendless.com/<application id>/<REST API Key>/files/<path>

The API to delete a directory uses the <path> element from the URL above.

Blocking API

public void BackendlessAPI.Backendless.Files.RemoveDirectory( string path )

Non-Blocking API

public void BackendlessAPI.Backendless.Files.RemoveDirectory( string path, AsyncCallback<object> callback )

where:

Argument                Description
path path of the directory to delete.
callback a responder object which receives a callback when the method successfully deletes the directory or if an error occurs.

Example

AsyncCallback<object> callback = new AsyncCallback<object>(
        result =>
        {
          System.Console.WriteLine( "Directory deleted" );
        },

        fault =>
        {
          System.Console.WriteLine( "Error - " + fault );
        } );

BackendlessAPI.Backendless.Files.Remove( "myfiles/pics", callback );

Codeless Reference

file_codeless_delete_directory_1

where:

Argument                Description
directory path A path leading to a directory which must be deleted along with other files and subdirectories. The path must start with the root directory of the remote file storage.

This operation does not return a value.

Consider the following directory:

file_codeless_delete_directory_2

The example below deletes the "async" directory.

file_codeless_delete_directory_3