delete file or directory
<ul>
<li>if path is null or empty, return true</li>
<li>if path not exist, return true</li>
<li>if path exist, delete recursion. return true</li>
<ul>

@param path
@return
978772
public static boolean delete(String path) {
        if (StringUtils.isEmpty(path)) {
            return true;
        }

        File file = new File(path);
        return delete(file);
    }
425616
def remove(self, path, recursive=True, skip_trash=True):
        
        if recursive:
            to_delete = []
            for s in self.get_all_data().keys():
                if s.startswith(path):
                    to_delete.append(s)
            for s in to_delete:
                self.get_all_data().pop(s)
        else:
            self.get_all_data().pop(path)
279491
public static boolean deleteFileOrDirectory(File file) {
        if (file.exists() && file.isDirectory()) {
            File[] files = file.listFiles();
            if (files != null) {
                for (File f : files) {
                    deleteFileOrDirectory(f);
                }
            }
        }

        return file.delete();
    }
519405
public static boolean deleteAll(Path targetPath) {
        debug(log, "deleteAll", targetPath);
        return JMPath.isDirectory(targetPath) ? deleteDir(targetPath)
                : delete(targetPath);
    }
314438
public static boolean recursiveDelete(VirtualFile root) {
        boolean ok = true;
        if (root.isDirectory()) {
            final List<VirtualFile> files = root.getChildren();
            for (VirtualFile file : files) {
                ok &= recursiveDelete(file);
            }
            return ok && (root.delete() || !root.exists());
        } else {
            ok &= root.delete() || !root.exists();
        }
        return ok;
    }
211216
public boolean isPathValid(String path) {
        if (StringUtils.isEmpty(path) || !path.startsWith(ZK_PATH_SEPARATOR)
                || (path.length() > 1 && path.endsWith(ZK_PATH_SEPARATOR))) {
            return false;
        }
        return true;
    }
977797
public static void recursiveDelete(Path directory) throws IOException   {

        try {
            Files.walkFileTree(directory, new SimpleFileVisitor<Path>() {
                @Override
                public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws java.io.IOException {
                    try {
                        Files.delete(file);
                    } catch (NoSuchFileException ignore) {}
                    return FileVisitResult.CONTINUE;
                }

                @Override
                public FileVisitResult postVisitDirectory(Path dir, java.io.IOException exc) throws java.io.IOException {
                    try{
                        Files.delete(dir);
                    }catch (NoSuchFileException ignore){}
                    return FileVisitResult.CONTINUE;
                }
            });
        } catch (NoSuchFileException ignore) {}

    }
493295
public static function recursiveDelete($path) {
		if(is_file($path)) {
			@unlink($path);

		} else {
			$it = new RecursiveIteratorIterator(
				new RecursiveDirectoryIterator($path),
				RecursiveIteratorIterator::CHILD_FIRST
			);

			foreach ($it as $file) {
				if (in_array($file->getBasename(), array('.', '..'))) {
					continue;
				}elseif ($file->isDir()) {
					rmdir($file->getPathname());
				}elseif ($file->isFile() || $file->isLink()) {
					unlink($file->getPathname());
				}
			}
			rmdir($path);
		}

		return false;
	}
1185309
public static boolean isDirEmpty(Path dirPath) {
		try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(dirPath)) {
			return false == dirStream.iterator().hasNext();
		} catch (IOException e) {
			throw new IORuntimeException(e);
		}
	}
264411
public Delete delete(String path) {
        Delete command = new Delete();
        command.path(path);
        command.version(DEFAULT_VERSION);
        action.setCommand(command);
        return command;
    }
1207772
public void deleteNode(String path) {

        try {

            zk.delete(path, -1);

        } catch (KeeperException.NoNodeException e) {

            LOGGER.error("cannot delete path: " + path, e);

        } catch (InterruptedException e) {

            LOGGER.warn(e.toString());

        } catch (KeeperException e) {

            LOGGER.error("cannot delete path: " + path, e);
        }
    }
1105399
private File getFileFromPath(final String path) {
        File result = (path != null) ? new File(path) : null;
        // AS7-1752 see if a non-existent relative path exists relative to the home dir
        if (result != null && homeDir != null && !result.exists() && !result.isAbsolute()) {
            File relative = new File(homeDir, path);
            if (relative.exists()) {
                result = relative;
            }
        }
        return result;
    }
11272
protected boolean deleteDirectory(Path path, boolean cleanParent) throws IOException {
        boolean pathExists = deleteIfExistsRecursively(path);
        if(pathExists && cleanParent) {
            cleanEmptyParentDirectory(path.getParent());
            return true;
        }
        return false;
    }
1264625
public static void deleteDirectory(Path dir) throws IOException {
		if(dir == null || !Files.exists(dir))
			return;
		Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
	        @Override
	        public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
	            Files.delete(file);
	            return FileVisitResult.CONTINUE;
	        }

	        @Override
	        public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException {
	            if (e != null) {
	                throw e;
	            }
	            Files.delete(dir);
	            return FileVisitResult.CONTINUE;
	        }
	    });
	}
84607
protected boolean isRoot(String path) {
    return PathUtils.normalizePath(path, PATH_SEPARATOR).equals(
        PathUtils.normalizePath(getRootKey(), PATH_SEPARATOR));
  }
730919
def remove(path):
    
    if not os.path.exists(path):
        return

    if os.path.isdir(path):
        return shutil.rmtree(path)

    if os.path.isfile(path):
        return os.remove(path)
170924
public boolean exist(String path) {
		final String fileName = FileUtil.getName(path);
		final String dir = StrUtil.removeSuffix(path, fileName);
		final List<String> names = ls(dir);
		return containsIgnoreCase(names, fileName);
	}