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
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: 20080

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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Directory creation date
It's not a secret anymore!