Name of the file in a directory

There is a file in a directory say C:\abcd
I want to find the name of the file in that directory.
There is only one file in that directory
How to proceed with this

Sarma,
That was a little abrupt and rude of you. Oracle_Friend was only asking if anyone knew of a way to detect the existence of a file in a directory, not exactly asking the world of us. And for all you know he probably has already searched in documentation, but probably isn't quite sure what to look for.
Remember : The manual has every damn thing that you want. We can only help you when you are stuck somewhere after having treid many options.a) sometimes people don't know what options to try so how can they have tried many options before posting on here.
b) The manual doesn't have every damn thing that you want. I want a lot of money and some lunch cos I'm getting hungry, but it doesn't have that. On a serious note though, the manuals do miss things and can't possibly cater for everybody's business requirements.
Chill out man, and help rather than hinder.

Similar Messages

  • How do U to get the names of all files in a directory?

    Is there a simple way to get all names of the files in a directory and put them in an array of Strings? Sounds simple, but I don't have a clue how to do this. Thanks.

    Hi Kindoo,
    Create a instance of File object using the path of the Directory
    File fileDir = new File(directoryPath);
    To get the List of all the files in the directory use
    String[] strFiles = fileDir.list();
    This will solve your problem,
    Cheers
    Nagaraj

  • Problem in copying the file to right directory

    Hi
    I am trying to copy a file uploaded by the user to a new directory. the dir structure is
    /data/temp/username/. The username dir is created at the time of upload. so if any user with the username say "bob" logs in, a directory bob is created under /data/temp.
    the file uploaded by the user needs to be stored under "bob" dir ....in my case its being stored in /data/temp.
    When i try to print file.getAbsoluetPath it shows me as the file is stored under bob....so i get /data/temp/bob/filename.doc
    but when i check the dir the file is actually stored under temp & not bob.
    Can anyone help please..
    Thanx

    Hi there
    Thanx for you reply.
    I read the snippet, but it says about Windows, I am working on Linux. Wont that make a diference when i getAbsoluetpath.. Coz the print statement shows me the path as /data/temp/username
    Also i ran a prototype of the code on windows and it seems to work fine ... like it creates a user directory under C:/Java/temp and then stores the file under the new created user directory.
    If the code would help to think in a better way heres it:
    /* tempdir is already defined in config file as /data/temp .. I am just calling it here to create
    the new directory under it.. this line works fine */
    File usrDir = new File(tempDir, username);
    boolean dirMade = usrDir.makeDir();
    String path = dirMade.getAbsolutePath();
    File fupload = new File(path, fileName);
    /* in the above line, fileName is the name of the file uploaded by client (user) */
    String filepath = fupload.getAbsolutePath();
    /* in tha bove line gives the path as /data/temp/username/filename.ext */
    but when i go to the directory its actually stored as /data/temp/username and /data/temp/filename.ext
    Any suggestions please
    Thanx

  • Moving the files from one directory to another.

    It seems that this would be simple but I am not able to do it easily. I just want to move files from one directory to another directory. I tried the file class renameTo as in the following...
    File fFrom = new File("C:\\uhin\\batch\\outgoing");
    File fTo = new File("C:\\uhin\\batch\\outgoing\\back");
    fFrom.renameTo(fTo);
    but this doesn't seem to work. I have tried deleting the directory and then recreating it but this doesn't seem to work as in.
    fTo.delete();
    fTo.mkdir();
    any ideas ?
    thanks
    kris.

    That code you have there tries to rename the directory from C:\uhin\batch\outgoing to C:\uhin\batch\outgoing\back. I'm not sure if you can rename directories in general, but even if you can that particular renaming wouldn't work.
    However you didn't want to rename the directory in any case. You need to use a File method called listFiles (if I recall correctly... check the API documentation) which returns an array of File objects, representing all the files in that directory. Then loop through that array, and for each File in it, (1) create a new File object with the new name, and (2) call renameTo() to rename the file.

  • Selecting all the files in a directory

    How would i select all the files in a directory, write the info of the files into a new file, and after the end of each file, make a New Line?

    hi zymus,
    check this code u will get the solution for ur problem..
    import java.io.*;
    public class files {
    public static void main(String[] args) {
    File f = new File("c://");// specify ur directory name here
    String[] n = f.list();
    System.out.println("ALL FILES.....");
                   if (n != null)
                             System.out.println("length = " + n.length);
    for (int i = 0; i < n.length; i++) { System.out.println("i = " + n[i]); }
                                  String[] n2 = f.list(new myJavaFileFilter());
                                  System.out.println("ALL JAVA FILES.....");
                                  if (n2 != null)
                                       System.out.println("length = " + n2.length);
    for (int i = 0; i < n2.length; i++)
         System.out.println("the files are::::::::: " + n2);
    class myJavaFileFilter implements FilenameFilter
    public boolean accept(File dir, String name)
         if (name.indexOf(".pdf") > 0)// give the file extension what u want
         return true;
    return false;

  • Getting names of all files in a directory.

    import java.io.*;
    import java.util.*;
    public class dir{
         public static void main(String args[]) throws IOException{
              //BufferedReader in = new BufferedReader(new FileReader(args[0]));
              PrintWriter out = new PrintWriter(new FileWriter("dir.txt"));
              File file = new File(args[0]);
              //FileFilter filefilter = "log";
              Vector x = new Vector();
              int vlength;
              x = getDirectoryContent(file);//,filefilter);
              vlength = x.size();
              for(int i=0;i<x.size();i++){
                   out.println(x.elementAt(i));
              out.close();
         public static Vector getDirectoryContent(File file){//, FileFilter fileFilter){
              Vector v= new Vector();
              if (file.isDirectory()) {
                   File[] content = file.listFiles();//fileFilter);
                   for (int i=0; i<content.length; i++){
                        v.addElement(content);
                   }//for
              }//is directory
              return v;
         }//getDirectoryContent
    That is the code that I am using, what I am trying to do with it is read all the files in a directory. So I can open them and calculate all the data in all of the files at the same time.
    These are the file names that are in the directory when I run the program.
    L0519013.log
    L0331001.log
    I have the code out put the file names in a file called dir.txt
    after running the program this is what I get in the output file.
    [Ljava.io.File;@70ccc4b2
    [Ljava.io.File;@70ccc4b2
    [Ljava.io.File;@70ccc4b2
    Any clue waht this means?
    also I am passing in the director as args[0]

    if possible as well...
    I could not get the FileFilter to work, could not get the syntax down to get it to work when I was initializing it so for the moment it is remed out. all files in the given directory will be of type .log so there really is no need for the FileFilter. But any help on how to include that in the code would be greatly helpful.
    Thankxs
    Korbin

  • When I download something from the Web, the "Downloads" window opens, but the window remains blank. Before it used to at least show the name of the file and I could open the file from the "Downloads" window. Is there a way to get this functionality back?

    I'm running Windows XP which is updated to latest version (which I think might be Service Pack 3, but not positive.) Mozilla Firefox is version 5.0. I tend to use Google as my search engine so most of the stuff I download comes through sites found through Google, which is also updated.
    At some time in the past (maybe a few versions ago) when I would download a file from the Web, the "Downloads" window would open and in the window would be displayed the name of the file I was downloading or had just completed downloading. I think I used to be able to then click on that file name and the file (or the installation file if needed to start the new program) would open. I am currently using Firefox 5.0 (the "About Firefox" screen says this is up to date) and when I download a file or document, the "Downloads" window appears on the screen as it always has in the past, but it remains blank, i.e., nothing appears in the downloads box. I don't remember making any configuration changes, etc., that may have caused the window to remain blank, but I could be mistaken. I know how to find the items I've downloaded (My Documents / Downloads) and can usually guess what the name of the downloaded file might be, but it used to be much easier when something (anything) showed up in the downloads window.
    I'd love for someone to tell me about a simple fix for this. I'm willing to be quite embarrassed that I did something I shouldn't have.'''

    In Firefox Options / Privacy be sure "Remember download history" is checked. To see all of the options on that panel, "Firefox will" must be set to "Use custom settings for history".
    To find your OS information, on your Windows desktop, right-click the My Computer icon, choose Properties, under System on that small window is info about your OS.
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''

  • Existing cross Reference: how to change the name of the file it refers to?

    Hi everybody,
    I am a professional translator.
    One client of mine sent me a complete FrameMaker 9 book file for translation.
    I translated the content via a CAT-Tool and now am in the process of checking if cross references and markers are ok directly into the file.
    I noticed that many cross references are linked to another file of the book. But in the process of translating each file separately, I gave them a slightly different name (I added the language at the end) so as to be able to recognise them eventually.
    Now I have this problem: I cannot find in the cross reference interface where to change the name of the file into the new one the cross reference is supposed to refer to.
    Am I right in wanting to change the file reference? If so, how do I do that?
    Or is it better to avoid this task and rename the translated file into their original names ? Would it work then?
    Thanks for your help.

    ... book file ...
    ...  each file separately, I gave  them a slightly different name (I added the language at the end) ...
    I'm guessing that you renamed the component files by means other than using the Edit > Rename File from the Book menu.
    If so, do over. Rename from the Book menu. It automatically revises all the cross-references in all the component files.
    In a Book, the only thing that's safe to rename with the file manager is the .book file itself.

  • I've installed LR on my new Mac - How do I find/what is the name of the file that opens to bring up my existing photos (on my external hd)?

    I've installed LR on my new Mac - How do I find/what is the name of the file that opens to bring up my existing photos (on my external hd)?

    Bookmarks and history are stored together in your profile folder in a database file named places.sqlite. These articles should help with restoring as much or as little of your other profile as you like:
    Locating the folder: [https://support.mozilla.com/en-US/kb/Profiles Profiles | How to | Firefox Help]
    The following article has suggestions for recovering bookmarks: [http://support.mozilla.com/en-US/kb/Lost%20Bookmarks Lost Bookmarks | Troubleshooting | Firefox Help].
    To move more settings, see: [https://support.mozilla.com/en-US/kb/Recovering+important+data+from+an+old+profile Recovering important data from an old profile].
    Hope this helps.

  • How can I get a file to copy all of the files in a directory except itself and the source of the copy function will be the directory the final program is in?

    How can I get a file to copy all of the files in a directory except itself and the source of the copy function will be the directory the final program is in? This application must be in Lab View 8.

    you mean something like this (see below)?
    Now you may have to implement code to check if the destination folder exists and to create it, etc.  But if you use the Front Panel Control to select the destination folder, it should be okay.
    Not the best implementation, mind you but you'll get the idea..
    Message Edited by JoeLabView on 04-18-2007 03:43 PM
    Attachments:
    copy folder contents.PNG ‏10 KB

  • Function Module that gives the names of the file in the Application Server.

    Hi Experts,
       Please give me a Function Module that gives the names of the file in the Application Server.
    Thanks,
    Debi.

    Hi,
    see these links
    http://help.sap.com/saphelp_nw04/helpdata/en/2a/fa02b7493111d182b70000e829fbfe/content.htm
    http://abaplovers.blogspot.com/2008/05/function-module-sap-logged-in-users-to.html
    http://www.saptechies.com/abap-function-modules/
    http://sap.ittoolbox.com/groups/technical-functional/sap-dev/function-module-to-get-data-and-time-of-file-576751
    thanks
    karthik

  • Need of a Webservice to get the name of the file in a Folder

    Hi All,
    I am in need of a Web service which should get the name of the file in a folder.
    Note :  Folder is created in the MOSS server.
    Thanks.

    Just to add, Mac in intergrated into AD and all I need is help in creating the script
    Thanks

  • Change File Name In The "File Download" Dialog Box For Web Reports

    Hi All ,
    I followed the below note to change the "File Download" name.
    How To Change The File Name In The "File Download" Dialog Box For Web Reports? Doc ID: Note:418366.1
    However its not working. Has anyone tried this and works fine ?
    Basically I wanted to change the name "rwservlet" when a report is run in an
    excel format.
    Rajesh Alex
    Rajesh Alex

    Hello,
    Have you checked if a HTTP header "Content-disposition" is returned ?
    You can use ieHTTPHEaders for IE
    http://www.blunck.se/iehttpheaders/iehttpheaders.html
    and
    Live HTTP Headers for FireFox
    https://addons.mozilla.org/en-US/firefox/addon/3829
    Regards

  • Could not save as (file name) because the file could not be found

    When i try saving sothing it comes up with could not save as (file name) because the file could not be found and need to save this file. i could save stuff before but not anymore if anyone could help i would be grateful
    im using photoshop cs5.1
    Thanks keiron

    We cannot know. These kinds of things are operating system errors with stuff getting blocked due to insufficient permissions, security tools interfering, network errors or whatever. Since you mentioned none of that, it's an "Ask your mom..." thing at this point, but if you provide more details, someone might be able to figure it out.
    Mylenium

  • "Could not save (file name) because the file is already in use or left open."

    Hello,
    When I tried save as a file, I get an error msg:
    "Could not save (file name) because the file is already in use or left open."
    The file is not open anywhere accept Photoshop.
    Mac Pro, OSX 10.5.6
    Photoshop CS4.
    I searched the forum but could not find anything even though i'm sure someone already asked it.
    would love to get a solution for that.
    thank you,
    shlomit

    There is a problem with both Photoshop and InDesign, then we can blame wich ever it is.
    1. I open a .psd file in Photoshop CS4 by double clicking it in Bridge
    2. This image is placed on a page in a open InDesign document.
    3. Doing some changes in Photoshop on the image.
    4. Trying to save and get this error message (this topics subject)
    5. Deleting the image from the page in ID doc, it is the only one in the document.
    6. Can't still save file.
    7. Closing ID completely and now I am able to save the file.
    I tried turning of Live preflight in Indegisn but that didn't help.
    So probably the fault is InDesign or the MacOS. I didn't have this problem with CS3. It is a stupid problem because this type of workflow is pretty common and one would expect it to be solved by now.
    Jan Suhr
    Stockholm, Sweden

Maybe you are looking for

  • Daily edition (prs 900) touchscreen problem

    Does anyone know what to do about this problem? The touchscreen on my prs 900 daily edition has stopped working. It just doesn't respond. You touch or tap or swipe and nothing happens - no response. I cant use any screen icons that depend on the touc

  • Getting star(*) as the value of the column

    Dear All, i have created a report on the cube which will display the country wise Expected sales Volume and Weighted sales volume. for all country i am getting the correct value but for the country which are NOT ASSIGNED i am getting Star(*) as the v

  • Customer cannot logon

    Customer can logon but when he tries to register for an email invite the account would not work. He asked for a password reset and now he cannot get in at all and has not gotten the password in email. 106177 account # [email protected] Customer needs

  • How long will shared fotostreams remain in  iCloud?

    I did Not really care about that as all pics have eben synced with Aperture. But now:  for how Long will they live in the cloud? Thx & br Dietmar

  • Pls send me xi material for real time specs.

    1) what is use of BPM  Tell me one scenario. 2) Tell me one  abap proxy scenario