Matt Gerrans
Posts: 1153
Nickname: matt
Registered: Feb, 2002
|
|
Re: File Properties
|
Posted: Apr 2, 2003 11:18 AM
|
|
You can get the lastModified date from the File object. I don't know about the created date...
If all else fails, a little RMI object could do the trick by calling the Windows API.
Or a really ugly trick would be to do a Runtime.exec() on "cmd /c dir d:\\path\\filespec >%temp%\fileinfo.txt" and then parse fileinfo.txt...
It would be nice if the Java API included some simple support for COM, such that you could use Dispatch. Then you could use the Windows Script Host objects (WScript.Shell, Scripting.FileSystemObject, and so on). This would solve a lot of these Windows-specific questions, without really causing Java to be platform dependent (you try to get an object with Dispatch, if the platform doesn't support it you get null). Unfortunately Sun and Microsoft are arch enemies, so such practicality is irrelevant.
|
|