expunge

Permanently deletes files in checkpoints older than the retention threshold from trash directory, and creates new checkpoint.

When checkpoint is created, recently deleted files in trash are moved under the checkpoint. Files in checkpoints older than fs.trash.interval will be permanently deleted on the next invocation of -expunge command.

If the file system supports this feature, users can configure creation and deletion of checkpoints periodically by the parameter stored as fs.trash.checkpoint.interval (in core-site.xml). This value should be smaller or equal to fs.trash.interval.

If the -immediate option is passed, all files in the trash for the current user are immediately deleted, ignoring the fs.trash.interval setting.

If the -fs option is passed, the supplied filesystem will be expunged, rather than the default filesystem and checkpoint is created.

The usage is as follows:

$ hadoop fs -expunge [-immediate] [-fs <path>]

Example:

$ hadoop fs -expunge --immediate -fs s3a://landsat-pds/
Found a mistake? Seleсt text and press Ctrl+Enter to report it