Finding a specific directory

Does anyone know how to find a specific directory on a users computer, knowing only the directory name? I know how to find a directory and stuff if I know the full path of it, but I don't know how to find it, if I don't know the full path, just the name..
Can anyone please help?

I don't know if this is a stupid idea or not, but I'm wanting to create a small program that deletes the temporary internet files, cookies and stuff like that...Sort of like DiskCleanup..
Right now I'm doing it via command line..
I'll post the source code, but it's not nearly finished...and I'm having problems with a few parts.
Here is how I am thinking I should do it: First I would have to find the root directory like c,a,d,e, but the problem with this, is theres probably cd drives and stuff on the users computer...So to start out with, how do you find out the root directory?
See, here is how I'm trying to find the root directory, but it doesn't work...
     for (char dirs='a'; dirs >= 'z'; dirs++)
          File path = new File(dirs + ":/");
               if (path.isDirectory())
                    startingPath = path;
                    System.out.println(startingPath.toString());
     return startingPath;
   }

Similar Messages

  • Find a specific word in a directory

    Hi Folks:
    I am trying to develop a apps, with the following functionality:
    To find for a specific word, like S010101, into a specific directory, saying something like: c:\Docs.
    And return, the number of ocurrences or, true if the string was found into a directory files or the name of the files wich include the string.....
    Can be possible with Oracle Forms or maybe with webtoolkit or with java and forms implementation?
    any ideas?
    Thanks a lot in advance
    Abdel Miranda
    Panama
    Edited by: aemsmeg on Jan 7, 2009 8:30 AM

    Hi Francois:
    Maybe I am trying to do something wrong, so let me give you a picture about my requirements and see if what I'm trying to do is on the rigth way.
    In my work, we have 4 environments: DEV, SYS, PRE and PROD. All of them has its own Schema and Objects, which are the same but they can have [and it is usual] different data stored.
    And, for every environment we have a migration directory with a tree like this:
    M:\\Apps\Request\S0001\DB\S0001_db.zip
    M:\\Apps\Request\S0002\DB\S0002_db.zip
    M:\\Apps\Request\S0003\DB\S0003_db.zip
    ................. and so far.
    Those zip files can have a sql files with a scripts which creates, modify, database objects and, the main issue, creates a customize user errors like: USR-xxxxx, VTM-xxxxx.
    As I wrote before, we have four environments, and I need to have track of which user errors codes are created and which one are available to use.
    By example, in DEV, the last user error code is USR-0005. If one of my developer need to generated the next user error code, he can select the max code where error type like USR. But maybe, another developer can generate the next user error code, in this case USR-0006. The developer team will not know where is the last error code generated, unless it find into the migration directory inside all of the zip files to see if exist in one of them, the insert for the next error code.
    I was thinking to develope a automatic ganeration form, where the developer, press a button. See the last error code and next error code related to a error type [USR, VTM].
    And then, press another button, select the migration directory [DEV, SYS or PRE] and find the string "USR-xxxxx" only in the qms_message.sql only in the _db.zip in the migration directory and all its sub directories.
    I am not sure If I am explain myself properly.
    Thanks a lot and any help, I will appreciated.
    Abdel Miranda
    Panama
    Edited by: aemsmeg on Jan 15, 2009 1:56 PM

  • Filter referenced pictures located in a specific directory

    I'm trying to consoliate all my pictures to a directory structure on external disk.   Most of my files 16K files are located there.    Of those 16K files, I have 6K files that are located on my local storage (MBA).    I would like to create a filter to find all referenced pictures located on specfic directory and not the external storage.   Something like where the directory like "/Mac HD/Users/myacct/Pictures/"  Is this possible?
    TIA,
    Scott

    Hi Scott,
    You can easily find all images on the system or the external volume, but not a specific directory without resorting to writing an AppleScript.
    Quit Aperture, then dismount (eject) your external volume, to make all originals on that volume offline, and then restart Aperture.
    Then define a search, or a smart album; with the added rule "File status is offline", and all your originals on the external volume should be listed in this album. Then flag them or tag them with a keyword or color label.
    A second album; "file status is online" should give you the images on the system drive.
    Regards
    Léonie

  • How to find a specific word in sentence in each line?

    How to find a specific word in sentence in each line and output will show start from the beginning from specific word plus with small description from each sentence?
    For example: I need to find a "+Wednesday+" and "+Thursday+" word in each sentence by line by line from "myfile.txt".
    Go ballet class next Wednesday.
    On the Wednesday is going to swim class.
    We have a meeting on Thursday at Panda's.
    Then it will show the output:
    Wednesday : ballet class
    Wednesday : swim class
    Thursday: meeting at Panda's
    I am going to figure out in Java console to read from a file for specific word from each line and how to make it output in correct way. I know already to make input/file codes.

    I got it and understand much better. Thank you very much. There is a problem with it because I knew how to make
    a specific word in sentence but how I should make Output for specific word and some words from sentence.
    For example:
    Input:
    +"On Thursday go to ballet class"+
    +"Swim class on Friday one time a month at 2 p.m."+
    I used the codes for that:
    class FindSchedule{
         String firstline = "On Thursday go to ballet class ";
         String secondline = "Swim class on Friday one time a month ";
         FindSchedule(){
              System.out.println(firstline + findTheIndex("Thursday", firstline));
              System.out.println(secondline + findTheIndex("Friday", secondline));
         public int findTheIndex(String word, String sentence){
              int index;
              index = sentence.indexOf(word);
              return index;
         public static void main (String[] args){
              new FindSchedule();
    }The output will be:
    Thursday: ballet class
    Friday: 14:00 swim class one time a week
    Notice that time is changing in output complete different from input.
    I need to find out how to extract some words from each sentence for output. Do you know how to do it?

  • Open files from a specific directory

    Dear all,
    I have the following source code that simply selects files from a directory.
    private void openFile()
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setFileSelectionMode(
    JFileChooser.FILES_ONLY );
    int result = fileChooser.showOpenDialog( this );
    // user clicked Cancel button on dialog
    if (result == JFileChooser.CANCEL_OPTION )
    return;
    File filename = fileChooser.getSelectedFile();
    if (filename == null || filename.getName().equals( "" ))
    JOptionPane.showMessageDialog( this,
    "Invalid File Name",
    "Invalid File Name", JOptionPane.ERROR_MESSAGE );
    else
    // open the file
    try
         // Open an input stream
         FileInputStream fin1 = new FileInputStream(filename);
    // Read and print a line of text
    BufferedReader d1 = new BufferedReader(new InputStreamReader(fin1));
    abs = d1.readLine();
    outputArea1.setText("");
    outputArea1.append(abs + "\n\n");
    outputArea1.setCaretPosition(0);
    // Close our input and output stream
    fin1.close();
    catch (IOException e5) {
    JOptionPane.showMessageDialog(this, "Error Opening File", "Error", JOptionPane.ERROR_MESSAGE);
    } // end catch
    } // end else
    } // end private
    My question is: Can I force it to open files from a specific directory, and NOT from MyDocuments directory????
    thanks,
    vxc

    \r = return
    \n = linefeed
    \j = illegal escape character
    JFileChooser fileChooser = new JFileChooser("C:\j2sdk1.4.2\bin");
    You could/should use:
    (new File).pathSeparator
    or
    (new File).pathSeparatorChar
    and
    (new File).separator
    or
    (new File).separatorChar
    http://java.sun.com/j2se/1.4.1/docs/api/java/io/File.html

  • How to find a specific text(string) in a list (100) programs

    Dear All,
    Wish tou a very happy new year 2009!!!
    please let me know how we can find a specific word(eg: "barrel") in a list of programs/reports/bdc/user exits/field exits/function modules.
    Thanks in advance.
    Kumar.

    hi kumar,
    open EWK1 transaction and search for the word or string according to your requirement.
    Cheers
    Gautham

  • Hi, I don't know how to find a specific security patch to apply to my Oracle database version to fix a vulnerability

    Hi, I don't know how to find a specific security patch to apply to my Oracle database version 11.2.0.2.0 (on windows server 2003 32 bits) to fix the following vulnerability:
    Risk: High
    Application: oracle_tnslsnr
    Port: 1521
    Protocol: tcp
    Synopsis:
    It is possible to register with a remote Oracle TNS listener.
    Description:
    The remote Oracle TNS listener allows service registration from a remote host. An attacker can exploit this issue to divert data from a
    legitimate database server or client to an attacker-specified system.
    Successful exploits will allow the attacker to manipulate database instances, potentially facilitating man-in-the-middle, sessionhijacking,
    or denial of service attacks on a legitimate database server.
    Solution:
    Apply the work-around in Oracle's advisory.
    Thank you for your help

    2835604 wrote:
    Hi, I don't know how to find a specific security patch to apply to my Oracle database version 11.2.0.2.0 (on windows server 2003 32 bits) to fix the following vulnerability:
    Risk: High
    Application: oracle_tnslsnr
    Port: 1521
    Protocol: tcp
    Synopsis:
    It is possible to register with a remote Oracle TNS listener.
    Description:
    The remote Oracle TNS listener allows service registration from a remote host. An attacker can exploit this issue to divert data from a
    legitimate database server or client to an attacker-specified system.
    Successful exploits will allow the attacker to manipulate database instances, potentially facilitating man-in-the-middle, sessionhijacking,
    or denial of service attacks on a legitimate database server.
    Solution:
    Apply the work-around in Oracle's advisory.
    Thank you for your help
    that sounds like the "tns poison" vulnerability.  CVE 2012-1675 - Oracle Security Alert CVE-2012-1675
    See MOS note 134083.1  and 1453883.1

  • How to find a specific song?

    I am looking for the song "To Sir With Love" by Lulu with the group The Mindbenders. My problem is that apparently there are two versions? And when I listen to the samples I can't tell if it's has the lyrics I'm looking for. I want the version which is sung in the movie which includes the line Those awkward years... Does anyone know how to find a specific version of a song? Thank you in advance for your help.

    Search the iTunes Store for "to sir, with love"
    One of the songs will contain in the title (from the Columbia movie.....
    No guarantee but I would guess that's the one you are looking for.
    http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewAlbum?i=193322123&id=19332 1271&s=143441

  • How To Find Oracle Home Directory Path...

    Hello,
    I am working on deployment of java web service on Oracle Application Server(LINUX) 10g, EBS - R12.
    I am working on other system and i want to deploy web service remotely on application server.
    And i am not getting the oracle home directory path. I want to find the home directory path remotely.
    so suggest me how to find out path of that.
    or weather i have to install jdevloper on server system and than i have to deploy it,
    or any other alternative way is available.
    Reply as soon as possible......

    Thanks for your reply.
    It's precisely the registry key which got tampered, and there's no ORACLE_HOME environmental variable(Or that too is tampered)
    Now,how to set it to one of the Oracle home directories?
    Regards,
    Bhagat
    !!!!!!!!!!!!!!!!!!!!

  • I have my personal music (not purchased from Itunes) stored in two locations, on my PC and on an external HD. How can I find out which directory itunes uses to access this music? I am using Itunes version 11.4.0.18. Thanks

    I have my personal music (not purchased from Itunes) stored in two locations, on my PC and on an external HD. How can I find out which directory itunes uses to access this music? I am using Itunes version 11.4.0.18. Thanks

    Many thanks JEM24 for your help.  Ive just spent the best part of six hundred pounds on a new Sony Rx100m2 compact camera, so I have no interest in the Ipods camera at all really. I doubt Ill be watching many videos on it as Im very lucky in that I have a good Android tablet. Its more as a stock music player that Ill be buying the Ipod for, if indeed I do end up buying one. I dont like the idea of paying the exorbitant amount added for more memory space that Apple along with most other companies charge. In fact I read an article on this very subject just yesterday in the tech section of Flipboard. It stated in the article that in the case of the Iphone  the actual cost of each additional  gigabyte of storage  to Apple et al is something in the order of 60p.. This is certainly not reflected in the price us the customer has to pay at the till.. Its for this reason primarily that Apple in particular, because their products do not allow adding expandable memory of your own in the form of cheap to buy cards, that nobody in their right mind buys the 64gig etc Iphones..I am aware that we are discussing my potential purchase of an Ipod Touch here but you see my point. Many thanks again though for helping me.

  • File path from specific directory

    hi all ,
    How to get full file path from specific directory having many folder inside that directory.
    I have file name and main directory name,please help me if you know about it

    I recognize that this post is half a year old at this writing, and the OP has probably long since either solved or abandoned the problem in question. That being stipulated: if I understand the question properly, the OP is stating that there is a directory named A, and contained somewhere within that directory or one (or more) of its subdirectories is one (or more) file(s) named abc.txt, and OP would like to be able to locate and obtain the canonical path to said file(s). While I am in no way a java maven, I've written a brief program which appears to do exactly that:
    import java.io.*;
    public class Main {
        public Main() {
            String whatImLookingFor = "abc.txt";
            String startingDirectory = "A";
            File path = new File("A");
            recursivelySearch(path, whatImLookingFor);
        private void recursivelySearch(File path, String whatImLookingFor) {
            try {
                if (path.isFile()) {
                    if (path.getName().equals(whatImLookingFor))
                        System.out.println(path.getCanonicalPath());
                else
                    if (path.isDirectory()) {
                        File[] currentFiles = path.listFiles();
                        for (int i=0; i<currentFiles.length; i++)
                            recursivelySearch(currentFiles, whatImLookingFor);
    catch(IOException ioe) {
    System.out.println("During search got error "+ioe.getMessage());
    public static void main(String[] args) {
    new Main();

  • File with list of .txt files in a specific directory

    Hi,
    I need to create a file with list of .txt files in a specific directory (actually the command will be used by a java application).
    I am using the below command,
    ls home/apptmt/park/*.txt > home/apptmt/park/reportgen.txt
    but this command prints output as
    home/apptmt/park/report1.txt
    home/apptmt/park/report2.txt
    home/apptmt/park/report3.txt
    I need only the files in reportgen.txt file, like
    report1.txt
    report2.txt
    report3.txt
    any one help me on the command I should use to get this output?
    Thanks
    MT

    Thank you Dude!
    I just found out that
    cd /home/apptmt/park;ls *.txt > reportgen.lst works for me...
    I will try this one as well... thank you very much...
    MT

  • MBP can't find one specific wifi network.

    The hotel where I live offers free wifi (The Cloud) and for months I've been using with full signal.
    Suddenly my MBP (mid 2010) was unable to find this network.
    My iPad and my iPhone (and friend's devices) are still connecting at any time with perfect full signal.
    I've tried holding alt+cmd+P+R at boot to reset PRAM and NVRAM but it still can't find that specif wifi network.

    Update: after another NVRAM and PRAM reset (alt+cmd+P+R) the wifi network shows up but I'm still unable to connect to it. When selected I've got a message of "connection timeout occurred" and the network disappears again.
    *All software is up to date.

  • HT201317 How can I find a specific photo in Photo Stream?

    How can I find a specific photo in Photo Stream?

    Yeah...that's the one thing that's odd about PS Touch; you'll have to browse for your desired images. I'm not sure if it expects for the user to have what could be hundreds of images in a folder (which is why I would prefer to go through Android Gallery; I can open the first image from Android Gallery into PS Touch, but if I want to add any more I have to do it PS Touch's way).

  • Monitor for .err file creation in a specific directory

    Does anyone know if it's possible to get SCOM to monitor a certain directory and then alert if a .err extension file is created there?   If so, are there any instructions you might be able to provide or resources to point me to?  I tried
    searching but wasn't having too much luck. Any assistance would be appreciated!

    Hi,
    I would like to suggest you create a monitor based on powershell script which can be used to test existance of .err file in a specific directory. The below command can be used to check .err extension existance under D:\specific directory
    Test-Path "D:\specific directory\*.err"
    Regards,
    Yan Li
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

Maybe you are looking for