Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Directory creation date

 
vasu kasukurthi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a requirement to read derectory creation and last modified date. Please any one help me how i get creation date of a directory and file.
Thanks in advance
 
Chinna Eranna
Ranch Hand
Posts: 174
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont think, java has api's for that.

One way is achieve it through JNI.
 
Chinna Eranna
Ranch Hand
Posts: 174
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the opensource FileTimes library in http://mindprod.com/products1.html..

Works only for Windows.
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The last modified date is available through lastModified(), but Chinna is right about the creation date. JNI or perhaps an external command line tool is the only way to do this. FileTimes uses JNI as well.

If you decide to program something like this yourself, keep in mind that Windows file creation times are not in milliseconds since January 1st 1970 00:00:00 but in blocks of 100 nanoseconds since January 1st 1601 00:00:00.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic