private void startRemoteDeletion() { File upFolder = new File(getCacheDir(), getString(R.string.upload_folder_path)); File fileToUpload = upFolder.listFiles()[0]; String remotePath = FileUtils.PATH_SEPARATOR + fileToUpload.getName(); RemoveRemoteFileOperation removeOperation = new RemoveRemoteFileOperation(remotePath); removeOperation.execute(mClient, this, mHandler); }
/** * Performs the rename operation. * * @param client Client object to communicate with the remote ownCloud server. */ @Override protected RemoteOperationResult run(OwnCloudClient client) { RemoteOperationResult result; try { Uri srcWebDavUri = removeChunksFolder ? client.getUploadsWebDavUri() : client.getUserFilesWebDavUri(); DeleteMethod deleteMethod = new DeleteMethod( new URL(srcWebDavUri + WebdavUtils.encodePath(mRemotePath))); int status = client.executeHttpMethod(deleteMethod); result = isSuccess(status) ? new RemoteOperationResult<>(OK) : new RemoteOperationResult<>(deleteMethod); Log_OC.i(TAG, "Remove " + mRemotePath + ": " + result.getLogMessage()); } catch (Exception e) { result = new RemoteOperationResult<>(e); Log_OC.e(TAG, "Remove " + mRemotePath + ": " + result.getLogMessage(), e); } return result; }