Reputation: 267
Suppose I have a the following hierarchy in my hdfs file system
Dir1
-> Dir2
-> File1
If I add a file named File 2 to /Dir1/Dir2, are the access and modification time of Dir1 and Dir2 going to change ? In general, when do these two values change ?
Also How to access those two values through the Hadoop Java API ?
Thank you for your answers
Upvotes: 2
Views: 3563
Reputation: 113
The time stamp of Dir2
changes but not for Dir1
. Only the immediate directory timestamp changes.
You can use the following in Java for getting timestamp :
FileSystem fs = FileSystem.get(URI.create(uri), conf);
long moddificationTime = fs
.getFileStatus((FileSplit)context.getInputSplit())
.getPath()).lastModified();
Upvotes: 1