This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Directory creation date" Watch "Directory creation date" New topic
Author

Directory creation date

vasu kasukurthi
Greenhorn

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 http://mindprod.com/products1.html..

Works only for Windows.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19684
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Directory creation date