How to get the last modification time of a directory in Java

1 Answer

0 votes
package javaapplication1;
 
import java.io.File;
import java.io.IOException;
import java.util.Date;
 
public class JavaApplication1 {
 
    public static void main(String[] args) throws IOException {
 
        try {
 
            File file = new File("d:\\xampp");
 
            long lastModified = file.lastModified();
 
            System.out.println(new Date(lastModified));
 
        } catch (Exception e) {
            System.out.print(e);
        }
    }
}
 
 
/*
         
run:
   
Wed Apr 06 01:28:53 IDT 2016
 
 */

 



answered Nov 17, 2016 by avibootz

Related questions

1 answer 198 views
1 answer 183 views
1 answer 169 views
1 answer 191 views
1 answer 185 views
185 views asked Jun 17, 2016 by avibootz
1 answer 195 views
...