Java examples for File Path IO:Directory
Getting and Setting the Modification Time of a File or Directory
import java.io.File; public class Main { public void m() throws Exception { File file = new File("filename"); // Get the last modified time long modifiedTime = file.lastModified(); // 0L is returned if the file does not exist // Set the last modified time long newModifiedTime = System.currentTimeMillis(); boolean success = file.setLastModified(newModifiedTime); if (!success) { // operation failed. }//from w ww . ja v a 2 s. c o m } }