You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by Frank Astier <fa...@yahoo-inc.com> on 2012/01/04 20:08:54 UTC

Setting HDFS directory time programmatically

Hi -

Is it possible to set the access time of a HDFS directory programmatically?

I’m using 0.20.204.0.

I need to do that in unit tests, where my clean up program is going to remove files/dirs whose access time is too far in the past. I can setTimes on the test files without any problem, but not on the directories... The directories created automatically when I create the test fiels have a date (with getAccessTime) of 1969/12/31 16:00 and I can’t control that date, which makes my unit testing impossible.

By the way, setTimes doesn’t allow to set the date on dirs, but getAccessTime is happy to return a date, which is inconsistent, IMHO.

Finally, on our production systems, I’m seeing appropriate dates for both files and directories.

Any insight appreciated,

Thanks!

Frank