This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes Search File at all locations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Search File at all locations" Watch "Search File at all locations" New topic

Search File at all locations

karan chandok

Joined: Jul 15, 2011
Posts: 25
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

Joined: Oct 27, 2005
Posts: 19656

Please KeepItDown. That doesn't include all uppercase letters but also larger fonts. It's completely unnecessary.

With 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:

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: Search File at all locations
Similar Threads
how to configure JBoss 5 in Eclipse 3.4 ?
How to find a file (any file) in Java
How to search specific file
B&S db file meta data, padding
rotating custom button, what paint method to ovveride