获取和设置文件或目录的修改时间
import java.io.File; /* NowJava.com - 时 代 Java 提 供 */ 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. } } }