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.
- (void)removeWithPath:(NSString * _Nonnull)path responseHandler:^(void)responseHandler errorHandler:^(Fault * _Nonnull)errorHandler;
- (void)removeWithPath:(NSString * _Nonnull)path pattern:(NSString * _Nonnull)pattern recursive:(BOOL)recursive responseHandler:^(void)responseHandler errorHandler:^(Fault * _Nonnull)errorHandler;
func remove(path: String, responseHandler: (() -> Void)!, errorHandler: ((Fault) -> Void)!)
func remove(path: String, pattern: String, recursive: Bool, responseHandler: (() -> Void)!, errorHandler: ((Fault) -> Void)!)
where:
Argument | Description |
---|---|
path |
path of the directory to delete. |
Example¶
[Backendless.shared.file removeWithPath:@"myfiles" responseHandler:^{
NSLog(@"File has been removed");
} errorHandler:^(Fault *fault) {
NSLog(@"Error: %@", fault.message);
}];
Backendless.shared.file.remove(path: "myfiles", responseHandler: {
print("File has been removed")
}, errorHandler: { fault in
print("Error: \(fault.message ?? "")")
})
Codeless Reference¶
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:
The example below deletes the "async"
directory.