HDFS How to Empty Trash
To empty the trash in HDFS just run this:
hdfs dfs -expunge
Files are stored in the trash when you delete them:
After a regular interval the Current directory is renamed to a time stamped directory like this:
The time stamped directory will eventually be deleted.
|fs.trash.interval||Number of minutes after which the checkpoint gets deleted|
|fs.trash.checkpoint.interval||Number of minutes between trash checkpoints|
NOTE - The trash may or may not be enabled so it is worth being aware of how your system is configured.
HDFS skipTrash Option
If you don’t want deleted files to go to the trash you can remove them permanently like this:
hdfs dfs -rm -skipTrash hdfs://my-host1:50070/my-dir1/my-file1.dat