Java 獲取文件創建時間

本功能只能在JDK1.7以上版本可以使用

String path = request.getSession().getServletContext().getRealPath("/")+"WEB-INF\\classes\\importTemplate\\";
FileTime t=Files.readAttributes(Paths.get(path+ipGroup+".txt"), BasicFileAttributes.class).creationTime();
                System.out.println("T:  "+t.toString());
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章