if (fs.isFile(file)) {
Path finalOutputPath = getFinalPath(file, src, dest);
if (!fs.rename(file, finalOutputPath)) {
if (!fs.delete(finalOutputPath, true)) {
throw new HowlException(ErrorType.ERROR_MOVE_FAILED, "Failed to delete existing path " + finalOutputPath);
}
if (!fs.rename(file, finalOutputPath)) {
throw new HowlException(ErrorType.ERROR_MOVE_FAILED, "Failed to move output to " + dest);
}
}
} else if(fs.getFileStatus(file).isDir()) {
FileStatus[] paths = fs.listStatus(file);
Path finalOutputPath = getFinalPath(file, src, dest);