Michail N
Michail N

Reputation: 3835

How to find in HDFS the creation date of a file

I need to find the creation date of a file or a folder in a hdfs directory. For example with:

hadoop fs -ls /user/myUser/ 

I get a list of files and directories in the path /user/myUser/ with the modification date. I want to find the creation date for each entry.

Upvotes: 6

Views: 10576

Answers (1)

tk421
tk421

Reputation: 5947

You can't get creation time, but you can get modification time. However in HDFS files typically get created once so modification time is likely the same as creation time. You can use the -stat command and run:

hadoop fs -stat "%y" /user/myUser/
hadoop fs -stat "%Y" /user/myUser/

All supported options are found in the source Stat.java:

enter image description here

Upvotes: 3

Related Questions