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

Similar Messages

  • 9I: How can get the names of all objects in a package header? [RESOLVED]

    Is there a way to get the names fo all objects (function, procedures) from package header
    select * from user_objects only gives the the header name, I need the object in the header.
    John
    Message was edited by:
    johnminkjan

    Here is an example with dbms_output package!
    SQL> select owner, object_name,procedure_name from all_procedures
      2  where  object_name='DBMS_OUTPUT';
    OWNER                          OBJECT_NAME                    PROCEDURE_NAME
    SYS                            DBMS_OUTPUT                    GET_LINES
    SYS                            DBMS_OUTPUT                    GET_LINE
    SYS                            DBMS_OUTPUT                    NEW_LINE
    SYS                            DBMS_OUTPUT                    PUT_LINE
    SYS                            DBMS_OUTPUT                    PUT_LINE
    SYS                            DBMS_OUTPUT                    PUT
    SYS                            DBMS_OUTPUT                    PUT
    SYS                            DBMS_OUTPUT                    DISABLE
    SYS                            DBMS_OUTPUT                    ENABLE
    9 rows selected.
    "or"
    SQL> desc dbms_output

  • Urgent: How to get the names of all menu items

    I have a .mmb menu module.
    There are many menus and submenus in it.
    Now I want to get the names of all menu items available in the module using sql or pl/sql.
    Actually I need to store these names in another table as it is. That is why I want get them programmatically.
    Any solution please.... bit urgent
    Thanks

    When I needed the same, I wrote my own application using
    Forms API (Windows,Forms 6.0,6i). Perhaps it will help
    you.
    Let me know your e-mail and I'll send it.

  • Can we get the name of fmx file at runtime

    Hi all,
    can we get the name of fmx file which is doing some DML operation on a specific table Can we back track which fmx module has done DML on a specific table. The reason I need this because I've 7 different fmx files which are doing some DML operation on a specific table and these fmx files were used by different users. Not necessarily 1:1 For eg. one user can do DML through 3 different fmx files. So in such case if I want to want to know from which fmx file this DML has take place .How can I achieve that. I know I can get the oracle username through v$session but it will not suffice my needs. I need the name of fmx file also.
    I'm using:
    Forms [32 Bit] Version 10.1.2.0.2 (Production)
    Oracle Database 10g Release 10.2.0.1.0 - Production
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Any help?
    Warm Regards
    Percy

    Percy,
    For that you can set the Module Field in the V$session in each form by,
    DBMS_APPLICATION_INFO.SET_MODULE(MODULE_NAME => :SYSTEM.CURRENT_FORM, ACTION_NAME => USER);Write this in each form, and then you will get the form name in the V$SESSION's module field with form name.
    Hope this helps.
    Regards,
    Manu.

  • Network : How can I get  the name of all computers in the lan ?

    Hi.
    Network : How can I get the name or the IP of all computers in the lan ?

    Easiest way to find all IPs would be to scan the network. Ping every possible IP in the network and all IPs that replied to the ping exist.
    Since I don't know how to do a ping in Java, I would scan for some Ports used by OS Services.
    Since I don't know which ports are used by windows, I think you should look for a ping class (or library).
    Scanning all ports for every IP in a class C network shouldn't take too long. And after finding one port you don't have to try the other ports for that IP, since it has to be online ;)

  • How do I get the name of a file in Xcode in a Cocoa-Applescript application?

    I'm trying ot create an app in Xcode using applescriptObjC. I need to get the names of files, but every time I run the app and trigger the part where the script is supposed to get the name, Xcode gives me an error saying "Can not get name of "/Users/xxxx/xxxx/xxxx.xxx" I have tried everything.
    Any help is appreciated

    can you post some relevant code?

  • Get the names of all netstreams in a netgroup

    I'm trying to build a many-to-many video chat room. I wonder how I can get the names of currently published netstreams within a netgroup. Thanks a lot.
    ilsh

    create a NetGroup for the groupspec.  add an event listener for NetStatusEvent.NET_STATUS.  observe info.code==NetGroup.MulticastStream.PublishNotify events.  info.name will have the name of the stream, and there will be one of these events for each distinct name of the published streams in the group.
    for more information, see the documentation for NetStatusEvent (check the "code" table in the entry for the "info" property):
       http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/NetStatusE vent.html

  • Getting the names of all classes

    Hi,
    I want to write a Java editor with code completion. Is there a way to get all the class names available in the installed Java run time environment.
    Does the reflection API provides a way to do it.
    Thanks a lot,
    Chamal.

    You can also look at JPDA (should be documented as part of your JDK under 'Tool Support' of the documents index), and the JDI api VirtualMachine.allClasses() method.
    That will return the name of all loaded classes, which will not be the same as all classes on the path, as it includes any dynamically created classes, and excludes any classes on the path not loaded.
    Pete

  • Function module to get the name of all the function module used

    I want to populate a internal table with the name of all function module used in the submitted program?? Is there any function module which return the name of all the function module used?

    Hi Priya
    Try this one RPY_FUNCTIONMODULE_READ.
    Ranga

  • Get the names of all tables

    First I want to tell you: I'm a amateur concerning Java Programming.
    My task is to write a java program - using JCO -, which retrieves the names of all tables (a user can access).
    Can anybody help me, please?

    Hi Michael,
    i can't help you because i don't know anything about JCO!
    It's simply funny and i'm happy to see a "known face" here!
    Perhaps this will help you:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sapportals.km.docs/documents/a1-8-4/tips and tricks for sap java connector client programming.pdf
    And don't be so decent...you're not so bad in Java at all
    Greetings
    Florian

  • How do you get the names of all your components on a JFRAME

    please help me on this issue. when i got the refrences it worked for me, however when i wanted to get the component name i got a NULL.

    Are you sure your components name is set ?

  • How do you find out the name of a file in a specific folder

    The problem I have is that I want to read from a file located on the harddrive. I know where it is located and that it is the last updated folder, but not the name of it.
    The reason for why I want the name is that I want to read som values from that specific file.
    Hope for fast answer.
    //Emelia

    Check out the File.list() and File.lastModified() methods:
    http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html

  • 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

  • My itunes does not get the names of all tracks which i import.

    When i import a cd into itunes, it does not get any track names. Why is this.
    Also, itunes does not connect to the music store. It tells me that i should check my connection etc etc. Are these problems related, and what can i do to fix it?

    Let me guess, did you just install/upgrade iTunes?
    If so, then it's surely your security software (firewall, web accelerator, privacy filters, etc) that is blocking iTunes.
    The iTunes "upgrade" is actually an uninstall, then total new install, of iTunes and QuickTime. Many security packages such as Norton, Zone Alarm, Google Web accelerator, McAfee, PCillin (...the list is long) see this new iTunes install as a malicious threat, and block out the previous settings without telling you.
    Go to your security software vendor's website and see if they have directions for allowing iTunes & QT back in the list of programs allowed to access the internet.

  • How can i get the name of a method

    i have a method which is calling another method.
    how can this submethod get the name from the main method?
    Thanks
    Thorsten

    There was a post about this a while ago, but I can't find it.
    Check out the getStackTrace method of Throwable (not the printStackTrace method). getStackTrace returns a StackTraceElement array. Each StackTraceElement has a getMethodName() method. In the returned array, the StackTraceElement at index 0 is the stack frame that the Throwable was created in, and the element at index 1 is the stack frame that your method was called from.
        public String getCurrentMethodName () {
            StackTraceElement[] st = (new Throwable()).getStackTrace();
            // Index 0 is the stack frame of "getCurrentMethodName"
            // Index 1 is the stack frame of the method that called this.
            // Index 2 is the stack frame of the method that called THAT.
            // Note that st[1] should always exist because this method
            // will always be called from another method (main, at very
            // least).  
            return st[1].getMethodName();
        public void myMethod () {
            System.out.println("The name of this method is " + getCurrentMethodName());
        };Hope that helps. I didn't test it, but it should work.
    Jason

Maybe you are looking for

  • SAP PS & SAP Project Management

    Hi all of you, Can any one give me clarity on the available functionalities in SAP Project Systems and that of SAP Project Management. My requirement is, my client is using one Project Management tool, where can get all the project monitoring and as

  • Anyone tried this - Extract data from HANA Live reuse views into BW?

    Hello Experts, I've read from this blog http://scn.sap.com/community/bw-hana/blog/2014/05/26/go-hybrid--sap-hana-live-sap-bw-data-integration that this scenario > "Loading of data into BW using Reuse Layer of SAP HANA Live as data source (Extract dat

  • JPQL: problem creating it dynamically

    I am building a JPQL String dynamically such that the entity requested and the criteria for the search will determine what the JPQL String will be. Example is like this         BaseQueryBuilder builder = new AnnuityPolicyQueryBuilder();         build

  • Symbian Anna launch - week38 add-on's

    Hi all, we don't have new countries added to our Symbian Anna rollout this week, but have Symbian Anna officially live in Bosnia & Croatia now and additionally released more updates for countries that have already launched Anna in the previous weeks.

  • I can't play the songs bought On iTunes. It will skip them and shuffle to the sync songs from computer.

    The player skips o ley the songs bought On iTunes and plays the oler ones. Do you know if i need to set something? Tks.