Skip to content

Deleting a File

To delete a file from the Backendless file storage, it must be identified by the file path/name. Files in the Backendless storage have the following URL structure:

https://api.backendless.com/<application id>/<REST API key>/files/<path>/<file name>

The API to delete a file uses the <path>/<filename> part to identify the file which must be deleted.

Blocking API

public void BackendlessAPI.Backendless.Files.Remove( string filePath )

Non-Blocking API

public void BackendlessAPI.Backendless.Files.Remove( string filePath, AsyncCallback callback )

 where:
 filePath - Path of the file to delete. The path must consist of the file path and file name. callback - A responder object which receives a callback when the method successfully deletes the file or if an error occurs. Example:

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

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

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

  
  
 Codeless Reference

 where:
 file path - A path identifying a directory where a file must be deleted. The path must start with the root directory of the remote file storage.  
 This operation does not return a value.
  
 Consider the following file stored in the notes directory:

  
 The example below deletes the "grocery.txt" file from the "notes" directory.