/**
+ * Getter for the file to remove (or removed, if the operation was successfully performed).
+ *
+ * @return File to remove or already removed.
+ */
+ public OCFile getFile() {
+ return mFileToRemove;
+ }
+
+
+ /**
* Performs the remove operation
*
* @param client Client object to communicate with the remote ownCloud server.
delete = new DeleteMethod(client.getBaseUri() + WebdavUtils.encodePath(mFileToRemove.getRemotePath()));
int status = client.executeMethod(delete, REMOVE_READ_TIMEOUT, REMOVE_CONNECTION_TIMEOUT);
if (delete.succeeded()) {
- mDataStorageManager.removeFile(mFileToRemove, mDeleteLocalCopy);
+ if (mFileToRemove.isDirectory()) {
+ mDataStorageManager.removeDirectory(mFileToRemove, true, mDeleteLocalCopy);
+ } else {
+ mDataStorageManager.removeFile(mFileToRemove, mDeleteLocalCopy);
+ }
}
delete.getResponseBodyAsString(); // exhaust the response, although not interesting
result = new RemoteOperationResult(delete.succeeded(), status);