File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes Directory creation date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Directory creation date" Watch "Directory creation date" New topic

Directory creation date

vasu kasukurthi

Joined: Dec 14, 2009
Posts: 9
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

Joined: Dec 08, 2009
Posts: 174

I dont think, java has api's for that.

One way is achieve it through JNI.

- Chinna
Chinna Eranna
Ranch Hand

Joined: Dec 08, 2009
Posts: 174

You can use the opensource FileTimes library in

Works only for Windows.
Rob Spoor

Joined: Oct 27, 2005
Posts: 19950

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.

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: Directory creation date