I was wondering if someone could help me. I am using java SWT and am trying to output a list of files and its properties to the screen. I have a file browser popping up and when i select a directory and click ok it outputs the path and list of files in that directory. However, i also want to output the type and created time of each file in that directory. i have an array that holds all the files but i am having trouble doing this. can anyone please help me.
hi friends..
i searched many forums to get file creation date
i didnt get the solution but i found one program which execute
dos command and gets the output of that.
so using that program i developed a program to get the file creation Date & Time also
You can get the last modification date of a file with File.lastModified(). That long can then be used to set the time in a Date or Calendar instance. Date prints nicely with toString() or you can use a DateFormatter. Avoiding OS calls has the advantage of not restricting your code to only work on Windows.
For the file type, I'm guessing that you mean the filename extension rather than a "magic number". You can use something like this:
Java is designed for use on deifferent platforms. Unix does not store creation date. That's why you can't get file creation date in java.
P.S.: hello from Ukraine.
Last edited by Murdok@i; Jun 2nd, 2011 at 6:11 am.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
This thread is currently closed and is not accepting any new replies.