package com.javaniu;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/**
* µÃµ½Ä³¸öwindowsÎļþµÄ´´½¨Ê±¼ä
*
* @author Administrator
*
*/
public class GetFileCreationDate {
public static void main(String[] args) {
try {
Process proc = Runtime.getRuntime().exec(
"cmd /c dir c:\\logfile.log /tc");
BufferedReader br = new BufferedReader(new InputStreamReader(
proc.getInputStream()));
String data = "";
// it's quite stupid but work
for (int i = 0; i < 6; i++) {
data = br.readLine();
}
System.out.println("Extracted value : " + data);
// split by space
StringTokenizer st = new StringTokenizer(data);
String date = st.nextToken();// Get date
String time = st.nextToken();// Get time
System.out.println("Creation Date : " + date);
System.out.println("Creation Time : " + time);
} catch (IOException e) {
e.printStackTrace();
}
}
}
最近下载更多
iamabcdef LV1
2017年9月6日
hope2027 LV17
2017年6月20日
zhaoxiaofa LV1
2017年4月18日
yuhangkit LV1
2015年8月21日
dddddddddd LV4
2015年3月28日
zhwindgone LV2
2015年3月6日
Icker LV4
2015年2月9日

最近浏览