lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Miller <markrmil...@gmail.com>
Subject Re: Using example Lucene 2.0 index class
Date Fri, 22 Sep 2006 19:46:07 GMT
Not to step out of Lucene world, but I would love to know the truth of 
the matter on this...the first site that search brings up on google 
seems to claim that was the behavior back at 1.2 or so and it is not the 
case anymore.

The javadocs don't seem to mention it:


      lastModified

public long *lastModified*()

    Returns the time that the file denoted by this abstract pathname was
    last modified.

    *Returns:*
        A |long| value representing the time the file was last modified,
        measured in milliseconds since the epoch (00:00:00 GMT, January
        1, 1970), or |0L| if the file does not exist or if an I/O error
        occurs 
    *Throws:*
        |SecurityException
        <http://java.sun.com/j2se/1.4.2/docs/api/java/lang/SecurityException.html>|
        - If a security manager exists and its
        ||SecurityManager.checkRead(java.lang.String)|
        <http://java.sun.com/j2se/1.4.2/docs/api/java/lang/SecurityManager.html#checkRead%28java.lang.String%29>|
        method denies read access to the file



Erick Erickson wrote:
> 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 <magawake@gmail.com> 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!
>>
>> TIA
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message