Setting File Modification Time This example sets the modified time of a file to the current time. File file = new File("filename"); boolean success = file.setLastModified( System.currentTimeMillis()); if (!success) { // operation failed. }