Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Search File at all locations

 
karan chandok
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying a program that can search file in all drives

But issue is it is searching for file only in current directory

Is there any way that I can find the file at all locations?

Thanks in Advance
 
Rob Spoor
Sheriff
Pie
Posts: 20753
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please KeepItDown. That doesn't include all uppercase letters but also larger fonts. It's completely unnecessary.

With java.io.File you can first use the static listRoots() methods to list all of the root files. You must then use a recursive method that for those. In pseudo code:
With java.nio.file.Path it's a bit different, because you can use FileVisitor:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic