This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Look through files in a directory  RSS feed

 
Mary Connolly
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I get a list of the files in a directory? I am aware of JFileChooser but it is not what I am looking. I need to search the contents of the xml files in the directory. I can do this with one file but need to do it with them all.
 
Carlos Failde
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
list()
"Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname."
e.g.
dir = new File( directoryname );
String[] contents = dir.list();
[ March 06, 2004: Message edited by: Carlos Failde ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!