Results 1 to 2 of 2

Thread: Listing Files or Subdirectories in Directory

  1. #1
    Garcíarobine is offline Senior Member
    Join Date
    Dec 2009
    Posts
    334
    Rep Power
    3

    Default Listing Files or Subdirectories in Directory

    I want to obtain list of the files or subdirectories in a directory in java. I am new in java programming, so please provide some kind of program related to it or any suggestions about it. Any help would be appreciated.

  2. #2
    RodríguezBrown is offline Senior Member
    Join Date
    Dec 2009
    Posts
    322
    Rep Power
    3

    Default

    The code given below help you to obtain list of files or subdirectories in directory.

    Code:
    File directory = new File ("dirname");    
    String [] str = directory.list ();
    if (str == null) 
    {
    } 
    else 
    {
    for (int i=0; i<str.length; i++) 
    {
    String Fname = str[i];
    }
    }

Similar Threads

  1. Listing of programs to be installed
    By clodey65 in forum Windows 7/2000/NT
    Replies: 2
    Last Post: 05-11-2009, 12:33 PM
  2. Directory
    By adlina in forum Everything Else
    Replies: 0
    Last Post: 03-23-2009, 11:40 AM
  3. Listing Files of Some Other Drive
    By Cadmus4778 in forum Everything Else
    Replies: 0
    Last Post: 11-29-2008, 12:28 PM
  4. Displaying Files of Some Other Directory/Drive
    By Cadmus4778 in forum Everything Else
    Replies: 0
    Last Post: 11-29-2008, 12:23 PM
  5. Word - Listing shortcut keys
    By hassik54 in forum Everything Else
    Replies: 0
    Last Post: 06-27-2008, 06:36 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48