0

Possible Duplicate:
How to discover a File's creation time with Java?

I want to get created date and time of file in java. How can i do it ?

Thanks in advance !!!!

Community
  • 1
  • 1
SilentBomb
  • 168
  • 2
  • 11
  • http://stackoverflow.com/questions/741466/how-to-get-creation-date-of-a-file-in-java – jmj Nov 04 '11 at 11:33
  • @ptomil for this i have to add extra library which is not my requirment.thsnks for reply. But is there any solution ? – SilentBomb Nov 04 '11 at 11:43

2 Answers2

2

How to get the file creation date in Java

Umer Hayat
  • 1,993
  • 5
  • 31
  • 58
1

You have cmd /c dir fileName command for doing this :

Try using

Runtime runtime = Runtime.getRuntime();

Process output = runtime.exec("cmd /c dir "+fname);

Process the output of runtime and get the desired stamp.

Sandeep Pathak
  • 10,567
  • 8
  • 45
  • 57
  • i have pass through this logic but its not working properly.this logic gives same date and time for every file. – SilentBomb Nov 04 '11 at 11:45