This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Java in General and the fly likes Find the path of a file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Find the path of a file" Watch "Find the path of a file" New topic
Author

Find the path of a file

renu richard
Ranch Hand

Joined: Oct 06, 2008
Posts: 116
Hi,

I want to know, is ther any java method available for doing this.

Requirement is like this. I need to find the location of a file in a directory. The file might be present in the parent directory or might even be present in the child directory.


Cheers,
Richard
Bubi gupta
Greenhorn

Joined: Sep 21, 2009
Posts: 14
Hi, Renu

This is very easily possible in java.Just give a search with a proper keyword .The souce code is also very easily available.You probably need to use proper API calls.Check the net.


Thanks a lot in advance for your support
BUBI gupta
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19232

Check out File.listFiles, possibly in combination with a FileFilter. You will need a recursive search: if a child of a folder is a folder itself, call the same method on that sub folder.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
 
 
subject: Find the path of a file
 
Similar Threads
Best practices for storing configuration/property files
Recursive file search
Loading xml in Javascript fails
Find with out recursive
java.lang.NoSuchMethodError: org.apache.log4j.Category.log