Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Checking file version, date and time stamp created

 
fayzal fauzie
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am thinking of a way if possible ? to write a program in java
to check particular files in particular directory in windows of above mentioned attributes -
the version of the file
the date it was created
the time it was created

these are mainly txt, bat for the time stamp check
and exe, dll for time stamp and its version

Is this platform specific stuff or i can make use a particular API, from java or any other API

any pointer is very much helpful ...

Thanks in advance
 
Joe Ess
Bartender
Posts: 9312
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried looking at the java.io.File API documentation? It will answer some of your questions.
 
Rob Spoor
Sheriff
Pie
Posts: 20606
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually it doesn't. File creation date/time isn't available, and neither is version. You'll have to go native, possibly using an existing library.
Should you choose to go native, be warned: Windows timestamps are not in milliseconds since January 1st 1970 at 0:00:00 but in numbers of 100 nanoseconds since January 1st 1601 at 0:00:00 (CET).
 
Joe Ess
Bartender
Posts: 9312
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote: File creation date/time isn't available,
.


If the file is not modified, lastModified() is the creation date.
 
fayzal fauzie
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Rob and Joe,

Thank you very much. Yes this indeed more than meets the eye .. and yea these files is not modified ( by right )...so one thing is solved.
Going native is not an option for theres 100 odd workstations i need to check these against and java only seems to be the only common thing
these workstations has currently.

Still opens for any suggestion.

Thanks
 
fayzal fauzie
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just show my appreciation to Rob and Joe,

I have opted to do this manually students are helpful these days ..

Thanks again for quick response.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic