lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <>
Subject Re: Using example Lucene 2.0 index class
Date Fri, 22 Sep 2006 17:46:22 GMT
Ya gotta use google, man <G>. This took about 15 seconds to find by googling

java file modification date

Get the "last modified" date from a file Simply use the lastModified()
method from a file object. but the return value is system dependent and
should only be used to compare with other values returned by last modified.
It should not be interpreted as an absolute time.

String s1 = "file1.dat";
String s2 = "file2.dat";

File f1 = new File(s1);
File f2 = new File(s2);

if (f1.lastModified() < f2.lastModified())
   System.out.println(s1 + " is older than " + s2);

On 9/22/06, Mag Gam <> wrote:
> Hi All,
> I have been using the Lucene 2.0 distro Index to index my files, currently
> it indexes filepath and contents. I want to index, lastModified() (Returns
> the time that the file denoted by this abstract pathname was last
> modified.), and file length, length().
> Can someone please show me how to do that? I am not too strong with Java,
> some example code would be nice!

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message