Searching for a particular file

Hi
I know the file name is odbc.ini and i know the drive name is c:
And how do i get the path of the file through program.
Thanx in advance.
Subhas

public static String retrieveFile() throws IOException{
          String s = "odbc.ini";
               String path = recursiveSearch(new File("c:\\"), s);
               // Make sure the "File" you create is a directory!!
               if (path != null) {
                    System.out.println("");
                    System.out.println("File Found");
                    System.out.print("The File Found at This Path: ");
                    //display the path
                    System.out.print(path);
               } else {         
                    System.out.println("File Not Found");
     return path;
     private static String recursiveSearch(File f, String name) {  
          // f is the directory to search for the file with name "name"
          File[] childs = f.listFiles();
          Vector dirs = new Vector();
          if (childs != null) {     
               for (int i = 0 ; i < childs.length ; i++) {       
                    if (childs.isDirectory()) { 
                         // If that is a directory we save it to search later
                         dirs.add(childs[i]);
                    } else { 
                         // Is a regular file
                         if (name.compareTo(childs[i].getName()) == 0) {  
                              // If the file is what we want we return his path
                              try {             
                                   return childs[i].getCanonicalPath();
                              } catch(Exception e) {             
                                   System.err.println("Error getting canonical path\n");
               for (int i = 0 ; i < dirs.size() ; i++) {       
                    File dirAux = (File)dirs.elementAt(i);
                    String aux = recursiveSearch(dirAux, name);
                    if (aux != null) {  
                         // We have found it inside this directory
                         return aux;
               // If we get here is because the file is not inside the directory or any subdirectory on it
          return null;
this code should work if you set it in a class of course ;)

Similar Messages

  • How can I search for a particular color in an image?

    Hi,
       I am working on images of colored balls.
    I want to search for the particular color (of the ball) and select them .
    How can I do it?
    Your suggestions will be helpful.
    Thanks
    dsk

    Hi Dsk, 
                   you can apply color threshold and extract the required color in the image. Try color threshold in vision assistant.
                  see  here
    Thanks as kudos only

  • Searching for a good file manager

    I'm searching for a good file manager. Konqueror 3.5 is quite good, dolphin 4.1 and konqueror 4.1 are not. Since konqueror 3.5 is going to die due to lack of support in the future, I kind of need to find a new good file manager...
    Do there exist file managers with the following features?
    Many of these features are things I thought were quite logical to be in a file manager, but seem to be missing in most "modern" ones...
    -independent of any desktop (gnome or KDE), just a standalone program
    -preferably not being both a web browser and file manager in once, at least not in an annoying way. Konqueror 3.5 shows that being that combination is possible without being annoying.
    -ability to have a tree view of the folders on one side and list view showing the files and subfolders of the folder currently selected in the tree on the other side
    -detailed list view showing at least filename, type, date and size, and the ability to sort according to any of these properties
    -a non-detailed view showing image contents would also be nice, to browse folders of photos or other images
    -ability to open files in certain programs if you doubleclick the file, NOT open it by singleclicking, singleclicking may only select it
    -ability to select multiple files by dragging box around files or using keys like "ctrl" and "shift"
    -ability to do "open terminal here" or type terminal commands in the current open directory
    -must have ability to drag files from one folder to another, from list view to tree view and vica versa, to move or copy them
    -and must have ability to use "ctrl+c" and "ctrl+v" to copy files and foldes from here to there
    -multiple tabs is a huge plus
    -favorites (to local folder paths) is also a huge plus
    -preview of files when hovering the mouse over them is nice
    -must have ability to zip and unzip (or other compression formats) folders by just right clicking them and choosing a zip/unzip command there
    -in addition to that, must also have ability to browse through a zip file as you would through a normal directory, and drag files from the insides of the zip file to the tree view to automatically unzip those files there, and of course "ctrl+c"/"ctrl+v" should also work to copy a file from the inside of the zip file, to some other folder on your disk
    -no horizontal autoscrolling in the tree view, that is an invention straight from the abyss...

    I know exactly how you feel about KDE 4 vs. 3 -- Konqueror was the best part of KDE for me (pretty much the only part I ever used, actually; my window manager is a slightly modified version of WMII and I generally loathe "desktop environments"). KDE 4 ruined it, completely and utterly.
    I submitted about 20 different bug reports about Konqeuror 4, mostly features that they'd deleted or mangled; some of them are starting to be addressed now. I don't think they'll ever fix the speed issues though, because those are dependent on the underlying KDE 4 libraries as far as I can tell -- it's as if KDE 4 were purposely and deliberately designed to be slower than KDE 3. Even if they fix all of its deficiencies, that'll probably keep me from using it...
    Right now there's KDEmod, which will hopefully maintain its KDE 3 branch for a while longer. It's starting to show some problems, though; I haven't been able to get kdemod konqueror 3 to work fully out of the box (the settings pages are all blank). On my main machine, I somehow managed to hack together some of the KDEmod3 packages so that I have a functional konqueror 3 running alongside the Arch repository's version of KDE4. I'm afraid to pacman -Syu now, though, because it will probably break horribly :P
    I don't remember exactly how I got konqueror 3 going like that, as I did it in my initial fit of rage after I did the pacman -Syu that got me KDE4 (a decision I have regretted ever since), but it was something like this:
    1. move /opt to /opt.kde4
    2. make a new /opt
    3. download several KDE 3 packages from the KDEmod3 repositories manually
    4. extract those packages into the new /opt with tar -xzf (NOT pacman!)
    5. try /opt/kde/bin/konqueror
    6. read reams of error messages about missing libraries, segfaults, etc.
    7. try to supply the missing libraries by downloading other kdemod3 packages and manually extracting them
    8. goto 5
    Then, when everything worked (sort of), I renamed some stuff so that 'konqueror' is konqueror 4 (I think having it konqueror 3 broke something else, but I don't remember what), and konqueror 3 is called 'k3nqueror'.
    If KDEmod3 ever goes away and there's no other good replacement file manager by then, I'll probably take the source code of KDE3 and try to make a standalone version of konqueror out of it. (Which will probably be quite a project because of how interdependent all the KDE components are.)
    Some features I "need" in a file manager, besides the ones you mentioned:
    - Konqueror's tree view (where you can expand folder branches in the file list)
    - Infinite view splitting -- I frequently have my konqueror windows split into 4, sometimes as many as 6 or 7 view panes. Very useful for sorting out files.
    - Selection rectangles are sensitive only over files -- I find full-row-select really annoying, because there are no guaranteed "blank" areas that you can click on to clear a selection. I also use this behaviour to grab long-named files that are interspersed with short ones, because they hilight first when the rectangle touches them (you wouldn't think this very useful, but surprisingly often you do want to do something to all the long-named files...)
    - Right-clicking on a folder and clicking "Paste" pastes into that folder, not the current one -- you'd be amazed at how many file managers get this wrong. I shouldn't have to cd into a folder just to paste some files there.

  • How to search for a particular word in notes app (ios6)

    Sir,
    I can search for a note but i couldnt search for a particular word in a long note in notes app.
    (ios 6)
    is there a way to do it,or is there any app that has this 'search for word' functionality ?

    thank you for your quick reply sir.
    i am asking for other independent notable apps(not notes app) which has this functionality .

  • How to search for a particular word in a string?

    How to search for a particular word in a string?
    thanks for your help....

    This works fine.
    public class Foo {
        public static void main(String[] args) {
        String s = "Now is the time for all good...";
        String s2 = "the time";
        System.out.println(s.contains(s2));
        System.out.println(s.contains("for al"));
        System.out.println(s.contains("not here"));
    }output:true
    true
    falseYou must have something else wrong in your code.
    JJ

  • How to search for a particular word in a long document?

    How to search for a particular word in a long document?

    What program are you using to read the document?
    Good luck.

  • How to search for a particular pattern in a string

    Hi,

    Hi ,
    How to search for a particular pattern in a string?
    I heard about java.util.regex; and used it in my jsp program.
    Program I used:
    <% page import="java.util.regex"%>
    <% boolean b=Pattern.matches("hello world","hello");
    out.println(b);%>
    I run this program using netbeans and am getting the following error message.
    "Cannot find the symbol : class regex"
    "Cannot find the symbol : variable Pattern "
    How to correct the error?

  • When I am searching for any particular song or album from my shared ITUNES folder, the search is conducted  in the apple store and not on the shared library. How to search for the song in the shared library

    I am using IPAD Mini.When I am searching for any particular song or album from my shared ITUNES folder, the search is conducted  in the apple store and not on the shared library. How to search for the song in the shared library

    Search for shared library is impossible, as far as I know.  Searches supported - are local and internet.

  • When I do a search for a particular song in the iTunes store, how can I change the view for the results?

    I have the latest version of iTunes.  Today I did a search for a particular song.  In the past, I used to get a list of the song and the various artists who recorded it, and I could click the little arrow and play a preview of that song before I decided to buy it.  Today the results didn't display that way - instead, I got a page with probably 50 or 100 songs all spread out across the page, and the "writing" was all overlayed so you couldn't quite tell what you're supposed to see!  I want to go back to the "list" view but couldn't find anywhere to change the view preference.  Any idea how?

    Do a malware check with some malware scan programs.<br />
    You need to scan with all programs because each program detects different malware.<br />
    Make sure that you update each program to get the latest version of the database before doing a scan.<br />
    * http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    * http://www.superantispyware.com/ - SuperAntispyware
    * http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    * http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    * http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    See also "Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked and [[Searches are redirected to another site]]
    There are other things that need attention:
    Your above posted system details show outdated plugin(s) with known security and stability risks that you should update.
    *Next Generation Java Plug-in 1.6.0_16 for Mozilla browsers
    Update the [[Java]] plugin to the latest version.
    *http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java Platform: Download JRE)

  • How Can I stop Elements 7 from searching for a memory file?

    Recently, every time I turn on Elements 7 it starts searching for a missing file each time it encounters a photo with a "?" in the corner. I must have pressed a key somewhere to start this function but now I can't get it to stop. I can only continue to another photo if I press cancel while it is searching but I have to do this for each "?" marked picture. Is there any way of cancelling this feature? Thanks in anticipation.

    Two solutions:
    1. Uncheck the option Edit > Preferences > Files > Automatically Search For And Reconnect Missing Files.
    2. Either reconnect the missing files or delete them from the catalog, using the File > Reconnect > All Missing command.  See this FAQ for tips on how to use the command:
    http://www.johnrellis.com/psedbtool/photoshop-elements-faq.htm#_Quickly_reconnecting_large
    Leaving missing files in your catalog doesn't have any benefit.

  • Search for a particular user

    I have configured LDAP authentication and mapped few LDAP user groups to BOXI. When an user group is added all the user will also be mapped to BOXI. For the users mapped the distinguished name is added as one of the alias.
    The requirement is to search for a particular user in the BOXI using the distinguished name(DN), hence need to query on the alias name or ID. I tried the query something like but didn't worked.
    SELECT * FROM CI_SYSTEMOBJECTS WHERE SI_KIND='User' AND SI_ALIASES.1.SI_NAME like '%DISTINGUISHED_NAME%'
    IF the DN is like cn=userName,ou=users,ou=group1, dc=myorg, dc=com and the query is written as it works.
    SELECT * FROM CI_SYSTEMOBJECTS WHERE SI_KIND='User' AND SI_ALIASES like '%userName%'
    Could you help in writing a query on the user alias.
    Thanks in advance.

    Here is yours for all posts, sorted chronologically from oldest to newest in descending order and showing 100 entries per page...
    http://forums.sdn.sap.com/search.jspa?userID=3743484&rankBy=1&threadID=&q=&objID=&dateRange=all&numResults=100
    You can play around with the available parameters a bit to tune it further.
    Cheers,
    Julius

  • When I open iMovie, the app searches for missing iPhoto files.  These are files I deleted.  I have to close about 30 dialog boxes before I can start using iMovie.  How do I make this stop?

    When I open iMovie (09), the app searches for missing iPhoto files.  These are files I deleted.  I have to close about 30 dialog boxes before I can start using iMovie.  How do I make this stop?

    So it seems the issue is when iMovie is wanting to creat thumbnails, if I ask it to ignore then it's fine but if not it hangs up searching for the video file.

  • How to search for the particular ABAP Object

    Hi,
    I am using the SAP 4.6C machine, I need to search for the particular ABAP Object. Plz can anyone help me in this.
    Regards,
    Pralhad P. Teggi

    You'll get a better response if you ask a meaningful question.
    If you want to scan for Business Objects (BOR) use transaction SWO1
    For ABAP classes / objects use a combination of transactions SE24 / SE18 / SE19 and /or SE80
    (SE 18 /  SE 19 are for Badi's)
    Cheers
    Jimbo

  • Total number of records when we do search for a particular item in Istore.

    Hi
    I need the total count of the records when we search for a particular item.
    I wrote a sql query using like condition which is match short and long description but in some cases it is failing.
    Can you guide,how to solve this issue.
    Thanks,
    Sabitha

    Sabitha,
    the mismatch could be due to the Fuzzy search profile option.
    Please check if fuzzy search has been enabled.
    Thanks
    Pradeep
    www.oracleappstips.com

  • Using URL maps to search for a particular sub-domain in a URL

    Hi Guys,
    Seem to be having some trouble with URL maps, and trying to search for a particular sub-domain in a URL.  Let me explain:
    We will have a number of applications frontended by our CSM VIP such as:
    sftp.poc.monash.edu.au
    callista.poc.monash.edu.au
    I'm trying to get the CSM via policies and URL maps, to search for say "callista" and direct this traffic to a particular farm as below...however when i use the match statement the connections are dropped.
    map CALLISTA url
      match protocol http url *callista*
    map CALLISTA-SFTP url
      match protocol http url *sftp*
    policy CALLISTA
      url-map CALLISTA
      sticky-group 197
      serverfarm CALLISTA
    policy CALLISTA-SFTP
      url-map CALLISTA-SFTP
      sticky-group 198
      serverfarm CALLISTA-SFTP
    vserver CAL-POC-DECVIP
      description decrypt VIP for SERVERFARM CAL-POC
      virtual 172.16.11.116 tcp www
      persistent rebalance
      parse-length 4000
      slb-policy CALLISTA
      slb-policy CALLISTA-SFTP
      inservice
    So i'm wondering if there is a better regular expression statement i can use to ensure that all the traffic that has "callista" in the URL is directed to a particular farm?
    thanks
    Sheldon

    Having a read through the CSM config guide I think i may have found the answer.  I noticed that the URL maps only work on searching a "path' after the domain e.g. the presence of either "index" or "cep":
    callista.poc.monash.edu.au/index.html
    or
    callista.poc.monash.edu.au/cep/
    I've tested the above logic and this holds true....therefore there doesn't seem to be a way of searching for a "subdomain" in the URL as opposed to various bits of a "path".  That is i'd like to search for "callista" or "admissions" instead of the path
    callista.poc.monash.edu.au
    or
    admission.poc.monash.edu.au
    Can someone confirm this one way or another?  And if the sub-domain search is not possible, are there alternatives to getting it to work?!
    thanks
    Sheldon

Maybe you are looking for

  • Spool overflow, spool_internal_error

    All SAP BASIS experts, I am facing a spool overflow problem. When user give any print command in QAS server, it is not completed. After some time error appear spool internal error / spool overflow problem. I am also checked data in RZ20-- SAP CCMS Mo

  • Error while invoking database stored procedure while mapping to varchar,int

    Hi I am using Oracle SOA 11g 11.1.1.4 In that i am calling db procedure.The procedure is taking input parameters int and varchar and nillable is true for both cases.Its a sybase data base. I am calling this db proc through db adater.Here I am mapping

  • Itunes will no longer sync my music to my brand new iPad.

    Itunes will no longer sync to my brand new iPad.  Synched with old one just fine.  Goes through process and finishes but still no music and no error.  Tried selecting specific artists or songs and same. Have lastest software on both. Running Windows

  • How to set an ActiveX Property

    Hi   I am having problems understanding how I can set a property of an ActiveX control in lookout. Here is what I am trying to do. I have an activex contol that shows a cctv camera's video.The video is showing up properly on my lookout screen. The na

  • IPod movies langauage selection

    Hello everybody: I have one question. How can I select the language for a movie to play in iPod 5G and iPod Classic? It's very easy to change language in my iPod Touch, but I haven't found the way on the 5G and Classic iPods. By the way, I've used Ha