This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to search for text files inside a folder ?

 
Rahul Sudip Bose
Ranch Hand
Posts: 637
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to :

1.Search for a TEXT file with a particular name inside a folder.
2.Store the name of this file in a string inside any java program.

Can you guide me ?

 
Joanne Neal
Rancher
Pie
Posts: 3742
16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the File class
 
Shawn Smith
Ranch Hand
Posts: 41
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try something like




Though this won't give you a recursive answer, you can certainly build up a looping construct that will.
 
Paul Clapham
Sheriff
Pie
Posts: 20196
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Shawn, welcome to the Ranch, and thanks for contributing!

Just one little thing... I added the "code tags" to your code. See how much more readable it is? All you have to do when you're posting code is to highlight the code and click the "Code" button which is above the box you're posting in.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic