Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a smart way of deleting old files from the hdfs /tmp directory? (Just to make sure, I am not talking about the unix FS /tmp)

share|improve this question
Define "smart". – mgorven Aug 9 '12 at 21:38
I can parse the output of -lsr but I dont consider it too smart. Also, I cant list anything by date :( – Istvan Aug 10 '12 at 20:05

hadoop fs -stat "%Y" "/path/*" Will output timestamps of everything in /path/. Use that along with a cut off as to what you consider too young and you can have this clean up in a shell script kicked off by cron.

This might be smarter then parsing other things outputted by hadoop fs.

share|improve this answer

Here's (the source code of) a small tool that does the job:

I might write one on my own (or port the given one to Python) so I don't need to create a build chain for Golang in my company.

And one more for Ruby users:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.