Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: to get name of all files from a particular directory to a list..

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default to get name of all files from a particular directory to a list..

    i want to get all the file names from a particular directory to a list..so how can i get it!!?


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: to get name of all files from a particular directory to a list..

    See the File class API doc. It has methods for doing that.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: to get name of all files from a particular directory to a list..

    Take a look at the API for the File class
    File (Java Platform SE 6)
    In particular the listFiles methods

  4. #4
    Junior Member
    Join Date
    Mar 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: to get name of all files from a particular directory to a list..

    hey thanks Norm and copeg..i got how to do it!!

  5. #5
    Junior Member
    Join Date
    Mar 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: to get name of all files from a particular directory to a list..

    hey i am using java swing in my program.so this class File is not working in swing so what should i use in swing to get all files from a particular directory?

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: to get name of all files from a particular directory to a list..

    this class File is not working
    Can you explain what "not working" means. The File class will work in a Swing application.
    Please post the full text of the error messages and the code that is causing the error.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Java program which can list all files in a given directory
    By JavaPF in forum Java Programming Tutorials
    Replies: 8
    Last Post: July 9th, 2013, 03:38 AM
  2. How to copy files from one directory to another directory
    By kewlkeny in forum File I/O & Other I/O Streams
    Replies: 4
    Last Post: January 25th, 2012, 07:36 AM
  3. Replies: 1
    Last Post: March 22nd, 2011, 06:59 PM
  4. Java program which can list all files in a given directory
    By JavaPF in forum Java Code Snippets and Tutorials
    Replies: 5
    Last Post: November 3rd, 2009, 09:42 AM