Remove files
Files can be removed from a storage bucket using the 'remove' API. If a file is protected by an identity Id, only the user who owns the file will be able to remove it.
Amplify.Storage.remove( StoragePath.fromString("public/myUploadedFileName.txt"), result -> Log.i("MyAmplifyApp", "Successfully removed: " + result.getPath()), error -> Log.e("MyAmplifyApp", "Remove failure", error));
Amplify.Storage.remove(StoragePath.fromString("public/myUploadedFileName.txt"), { Log.i("MyAmplifyApp", "Successfully removed: ${it.path}") }, { Log.e("MyAmplifyApp", "Remove failure", it) })
try { val result = Amplify.Storage.remove(StoragePath.fromString("public/myUploadedFileName.txt")) Log.i("MyAmplifyApp", "Successfully removed: ${result.path}")} catch (error: StorageException) { Log.e("MyAmplifyApp", "Remove failure", error)}
RxAmplify.Storage.remove(StoragePath.fromString("public/myUploadedFileName.txt")) .subscribe( result -> Log.i("MyAmplifyApp", "Successfully removed: " + result.getPath()), error -> Log.e("MyAmplifyApp", "Remove failure", error) );