• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to search file by name?

 
Pier Klein
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to implement the following function:
provide a full file name and then find it out by searching a existing folder, if successful, return the full path of the file.
Does anybody know how to do that in Java?
Thanks!
 
John Wetherbie
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This isn't really a GUI question from what I can tell. Moving this to I/O and Streams.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you want to search a specified directory and subdirectories to find a given filename. It could be something like:

Are you familiar with recursion? It's a bit spooky the first time, and it's easy to mess up so it runs forever. Read up on the file APIs and add to this post if you'd like more detailed help. For basic recursion questions, skip down to the general Java forumses.
Hope that helps!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!