http://blog.youkuaiyun.com/java05/article/details/4001566
为了获取文件的最后更新时间:
public static String getLastModified(String file) throws URISyntaxException
{
File indexfile = new File(new URI(file));
//System.out.println(indexfile);
//System.out.println(indexfile.lastModified());
Date date=new Date(indexfile.lastModified());
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd kk:mm");
String time=sdf.format(date);
return time;
}
Unix下调用:
getLastModified("file:/home/www/jsp/index.jsp");
Windows :
getLastModified("file:/D:/soft/apache-tomcat-6.0.33/index.jsp");