| Author |
How to know when was th e file open/modified
|
pankaj patil
Ranch Hand
Joined: Dec 19, 2004
Posts: 98
|
|
hi How can i know when was the file opened /modified in java Thx in Advance Pankaj
|
Regards,
Pankaj Patil
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24054
|
|
|
By using the lastModified() method in java.io.File .
|
[Jess in Action][AskingGoodQuestions]
|
 |
Mani Ram
Ranch Hand
Joined: Mar 11, 2002
Posts: 1140
|
|
You can use lastModified() method in java.io.File class to get the time at which the file was last modified. But you cannot get the time at which the file was last accessed / opened using java API.
|
Mani
Quaerendo Invenietis
|
 |
pankaj patil
Ranch Hand
Joined: Dec 19, 2004
Posts: 98
|
|
Thx for the reply . there r no java API which can tell me when was the file opened . is there any way by which i can restrict the file to be get opened.
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24054
|
|
There's no Java API that reports when a file was last accessed because not all operating systems can tell you the needed information: UNIX can, but I don't think Windows can. Likewise, there's not much of an API for file protection in Java because, again, not all OSs support that idea. There is a method setReadOnly() in java.io.File that lets you mark a file as read-only, but that's about it.
|
 |
pankaj patil
Ranch Hand
Joined: Dec 19, 2004
Posts: 98
|
|
|
thanks for reply
|
 |
 |
|
|
subject: How to know when was th e file open/modified
|
|
|