rm
Deletes files specified as args.
If trash is enabled, moves the deleted file to the .Trash directory (given by getTrashRoot).
Returns 0
on success and -1
on error.
The usage is as follows:
$ hadoop fs -rm [-f] [-r |-R] [-skipTrash] [-safely] URI [URI ...]
-f |
Doesn’t display a diagnostic message or modify the exit status to reflect an error if the file doesn’t exist |
-R |
Deletes the directory and any content under it recursively |
-r |
Equivalent to the |
-skipTrash |
Bypasses the trash function, if enabled, and deletes the specified file(s) immediately. This can be useful when it is necessary to delete files from an over-quota directory |
-safely |
Requires safety confirmation before deleting directory with total number of files greater than |
Example:
$ hadoop fs -rm hdfs://nn.example.com/file /user/hadoop/emptydir