File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Murach's Java Servlets and JSP this week in the Servlets 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: 19649
    
  18

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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Directory creation date
 
Similar Threads
server date
How to get the Date of creation of a File[very.... Urgent....]
File Creation Date using JNI
getting all the files from a directory for latest date,time
How to delete files in a directory older than n days