• Post Reply Bookmark Topic Watch Topic
  • New Topic

file API  RSS feed

 
mark I thomas
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I get a list of file names under a certain directory ?
 
Mohamed Sanaulla
Bartender
Posts: 3185
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mark I thomas wrote:How can I get a list of file names under a certain directory ?


java.io.File class would have list of methods.
 
mark I thomas
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I got the idea of getting the file name lists. Is there a way I can get a list of files sorted by their time stamp ? I don't see such API there.
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not directly. You can sort the array using Collections.sort and a custom Comparator<File>.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!