How to find in HDFS the creation date of a file

时间:2019-03-19 14:49:17

标签: hadoop hdfs

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.

1 个答案:

答案 0 :(得分:0)

您无法获得创建时间,但是可以获得修改时间。但是,在HDFS文件中,文件通常只创建一次,因此修改时间可能与创建时间相同。您可以使用-stat command并运行:

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

在源Stat.java中找到所有受支持的选项:

enter image description here