473,396 Members | 2,011 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,396 software developers and data experts.

How do I search for a file in a folderand its subfolders?

19
Hi! I'm trying to open a pdf file and this way works fine when the pdf it's in C:
try
{
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + "c:\\tuto.pdf");
}
but now I don't know the tuto.pdf path, I know it looks like this:
SOMETHINGHERE \ MyApplication\Totorials\tuto.pdf, but how could I find the SOMETHINGHERE part of the path?
Feb 6 '08 #1
7 2684
BigDaddyLH
1,216 Expert 1GB
Hi! I'm trying to open a pdf file and this way works fine when the pdf it's in C:
try
{
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + "c:\\tuto.pdf");
}
but now I don't know the tuto.pdf path, I know it looks like this:
SOMETHINGHERE \ MyApplication\Totorials\tuto.pdf, but how could I find the SOMETHINGHERE part of the path?
This is not a Java or a PDF question is it? How you find the path of a file? You must know where it is to begin with, right? Otherwise this is like asking "how long is a piece of string?"
Feb 6 '08 #2
r035198x
13,262 8TB
Hi! I'm trying to open a pdf file and this way works fine when the pdf it's in C:
try
{
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + "c:\\tuto.pdf");
}
but now I don't know the tuto.pdf path, I know it looks like this:
SOMETHINGHERE \ MyApplication\Totorials\tuto.pdf, but how could I find the SOMETHINGHERE part of the path?
You could transform this problem to "How do I search for a file in a folder and it's subfolders".
Feb 6 '08 #4
BigDaddyLH
1,216 Expert 1GB
You could transform this problem to "How do I search for a file in a folder and it's subfolders".
Yessssssssssssssssss
Feb 6 '08 #5
r035198x
13,262 8TB
Yessssssssssssssssss
Argh, I didn't mean you SmallDaddy ...
Feb 6 '08 #6
aleplgr
19
Yes, you are right, thanks, the file I'm searching it's located in a fixed folder in MyApplication folder, but MyApplication folder will be distributed to other users that I don't know where are going to locate it. To find the path to MyApplication folder I'm using this:
String wd = System.getProperty("user.dir");
and it's working ok, what do you think about it?
Thanks
Feb 7 '08 #7
BigDaddyLH
1,216 Expert 1GB
Yes, you are right, thanks, the file I'm searching it's located in a fixed folder in MyApplication folder, but MyApplication folder will be distributed to other users that I don't know where are going to locate it. To find the path to MyApplication folder I'm using this:
String wd = System.getProperty("user.dir");
and it's working ok, what do you think about it?
Thanks
If directory MyApplication is in the user's home directory that works. If not, it doesn't.
Feb 7 '08 #8

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

Similar topics

11
by: Ben | last post by:
Greetings, I am looking for a way to search for and delete files based on a pattern mask. For example, the search method would find all files matching a certain pattern containing wildcards (e.g....
1
by: Les Juby | last post by:
A year or two back I needed a search script to scan thru HTML files on a client site. Usual sorta thing. A quick search turned up a neat script that provided great search results. It was fast,...
0
by: mm | last post by:
Can someone with Win 2K please help me here. Best yet, can some MVP duplicate it and report it to MS. I can't find any reference to this issue on the Web, or in MS Knowledge Base. I have been...
8
by: Roomy | last post by:
Guys, I'd love if any of you can help me with this one. I need a script that will take out the words Error, Warning, and Aborted from a 12mb text file and into a new text file after running the...
2
by: Philip Wagenaar | last post by:
How do I search for a directory on a windows xp machine and delete the directory including all subfolders and files in them?
3
by: majik92 | last post by:
Okay, I've just created this PHP script and know to finish it off, I want to add a search feature. I want the search to search in a folder called "songs/". The songs/ folder is full of .txt files...
1
by: Bigrabid | last post by:
Howdy, I have an access database that I use to keep track of projects that my group is working on. There are a number of files associated with any one project, so I have as a parent to , which...
3
by: =?Utf-8?B?UGVycmlud29sZg==?= | last post by:
Not sure where to post this... Found some interesting behavior in Windows Search (Start =Search =All files and folders =search for "A word or phrase in the file:"). This applies to XP and maybe...
0
by: =?Utf-8?B?QnJ5YW4=?= | last post by:
Hello group. I've migrated from Win 2003 server to Win 2008 server. I've been banging my head agaist a wall for several days now trying to figure this out. I have the following script that will...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.