public IProcessComponent delete(File file) throws NoSessionException, NoPeerConnectionException {
if (!FileUtil.isInH2HDirectory(file, networkManager.getSession())) {
throw new IllegalArgumentException("File is not in the Hive2Hive directory");
}
IProcessComponent deleteProcess;
if (file.isDirectory() && file.listFiles().length > 0) {
// delete the files recursively
List<Path> preorderList = FileRecursionUtil.getPreorderList(file.toPath());
deleteProcess = FileRecursionUtil.buildDeletionProcess(preorderList, networkManager);
} else {