473,385 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Geeting the path of a file...

Hi, I pass a file name or a directory name to the java code, It should show me the correct path where that file or folder is present... Can any one help me with some idea please...... quick responce is highly appreciated......
Regards
Srinivasa Reddy
Apr 11 '07 #1
4 1194
JosAH
11,448 Expert 8TB
Suppose I pass it the name "foo" and both /a/foo and /b/foo are present in the
file system. What is your program supposed to do? Find one instance? Find
them all?

kind regards,

Jos
Apr 11 '07 #2
Hi Jos,
Thanks for the quick reply, I want to find all the files with that name no matter which folder it may be.....
Regards,
Srinivasa Reddy



Suppose I pass it the name "foo" and both /a/foo and /b/foo are present in the
file system. What is your program supposed to do? Find one instance? Find
them all?

kind regards,

Jos
Apr 11 '07 #3
JosAH
11,448 Expert 8TB
Hi Jos,
Thanks for the quick reply, I want to find all the files with that name no matter which folder it may be.....
Regards,
Srinivasa Reddy
Check out the methods of the File class then; it has all the method
you need. Start at the root(s) of your file system and traverse the entire
directory hierarchy recursively; keep printing out the absolute path name
of the current file/directory if it matches your criteria.

kind regards,

Jos
Apr 11 '07 #4
thanks Jos,
thanks for your suggestion.... I will try it and get back to you if i have any issues...
Thanks once again....

Check out the methods of the File class then; it has all the method
you need. Start at the root(s) of your file system and traverse the entire
directory hierarchy recursively; keep printing out the absolute path name
of the current file/directory if it matches your criteria.

kind regards,

Jos
Apr 11 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

31
by: John Roth | last post by:
I'm adding a thread for comments on Gerrit Holl's pre-pep, which can be found here: http://tinyurl.com/2578q Frankly, I like the idea. It's about time that all of the file and directory stuff...
2
by: Steven Burn | last post by:
Oks, I know I'm going to seem completely stupid here but, I have a question thats been doing my head in for the last few hours. Basically, I'm trying to find a way to turn a folder and file path,...
70
by: Michael Hoffman | last post by:
Many of you are familiar with Jason Orendorff's path module <http://www.jorendorff.com/articles/python/path/>, which is frequently recommended here on c.l.p. I submitted an RFE to add it to the...
34
by: Reinhold Birkenfeld | last post by:
Hi, the arguments in the previous thread were convincing enough, so I made the Path class inherit from str/unicode again. It still can be found in CVS:...
2
by: Rob Cowie | last post by:
Hi, Given a string representing the path to a file, what is the best way to get at the filename? Does the OS module provide a function to parse the path? or is it acceptable to split the string...
15
by: (Pete Cresswell) | last post by:
I've got a .BAT file that I use for executing various MS Access apps that I wrote way back in the days of 2.0. It's evolved over time, but it still contains a number of possible paths to...
5
by: Sakharam Phapale | last post by:
Hi All, I am using an API function, which takes file path as an input. When file path contains special characters (@,#,$,%,&,^, etc), API function gives an error as "Unable to open input file"....
6
by: Prasad | last post by:
HI all, <!-- ======== This is the division with width & height set to 100% and z-index to -1 =======- --> <div...
1
by: Nehad9 | last post by:
Hi, I am trying to FTP a file using ftp.exe under cmd.exe from ASP. When i run the same from command prompt, the file gets posted on the remore server. However, doing it from ASP code under...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.