• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to sort files based of creation of time,

 
sudhakar ananth
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends

how to sort files based on creation time

1. how can we get the creation time of a file and how to sort based of creation like FIFO type
example a.txt 2.55 pm 2006
b.txt 3.07 am 2004
c.txt 1.04 pm 2007
e.txt 1.07 am 2004

so sorting should give e.txt,b.txt,a.txt and c.txt

so please tell me how to sort and where can get a method to get the sort or get the time of file...

please friends urgent..
bye
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please take the time to choose the correct forum for your posts. This forum is for questions on Servlets.

This post has been moved to a more appropriate forum.
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you thought the possibility of using a java.util.Comparator?

Unfortunately I could find a method in the File class that tells me the creation time, but only the last modification time.



Then you can use it to sort list of files:


[ March 25, 2007: Message edited by: Edwin Dalorzo ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic