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日
最近浏览更多
zhan88  LV1 2023年4月12日
汤汤汤要学编程  LV11 2020年11月26日
aihui523  LV34 2020年7月3日
cpla1998  LV8 2020年5月21日
wei112233  LV15 2020年4月21日
xuajzaz  LV10 2020年4月8日
醉春花  LV4 2020年1月8日
abcdd12  LV2 2018年6月19日
低调人  LV38 2018年5月21日
shuilianbing  LV6 2018年5月19日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友