首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

失去指定文件的时间和大小

2012-12-23 
得到指定文件的时间和大小public String getFileTime(String filename) {String filetime try {Proce

得到指定文件的时间和大小
public String getFileTime(String filename) {
String filetime = "";
try {
Process p = Runtime.getRuntime().exec(
"cmd /C dir d:\\upload\" + filename + " /tc");
InputStream is = p.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));

String str;
int i = 0;
while ((str = br.readLine()) != null) {
i++;
if (i == 6) {
filetime = str;

}
}

} catch (java.io.IOException exc) {
exc.printStackTrace();
}
return filetime;

}

热点排行