@CliCommand(value = PREFIX + "rm", help = "Remove files in the HDFS")
	public void rm(
			@CliOption(key = { "", PATH }, mandatory = false, unspecifiedDefaultValue = ".", help = "path to be deleted") final String path,
			@CliOption(key = { "skipTrash" }, mandatory = false, specifiedDefaultValue = TRUE, unspecifiedDefaultValue = FALSE, help = "whether to skip trash") final boolean skipTrash,
			@CliOption(key = { RECURSIVE }, mandatory = false, specifiedDefaultValue = TRUE, unspecifiedDefaultValue = FALSE, help = "whether to recurse") final boolean recursive) {
		try {
			Path file = new Path(path);
			FileSystem fs = file.getFileSystem(getHadoopConfiguration());
			for (Path p : FileUtil.stat2Paths(fs.globStatus(file), file)) {
				FileStatus status = fs.getFileStatus(p);
				if (status.isDirectory() && !recursive) {
					LOG.error("To remove directory, please use 'fs rm </path/to/dir> --recursive' instead");
					return;
				}
				if (!skipTrash) {
					Trash trash = new Trash(fs, getHadoopConfiguration());
					trash.moveToTrash(p);
				}
				fs.delete(p, recursive);
			}
		}
		catch (Exception t) {
			LOG.error("Exception: run HDFS shell failed. Message is: " + t.getMessage());
		}
		catch (Error t) {
			LOG.error("Error: run HDFS shell failed. Message is: " + t.getMessage());
		}
	}
HDFS shell commands

@author Jarred Li
@author Glenn Renfro
spring-xd-shell/src/main/java/org/springframework/xd/shell/hadoop/FsShellCommands.java