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 5 of 5

Thread: Search file program

  1. #1
    Junior Member
    Join Date
    Sep 2010
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Search file program

    Hi all, I'm writing here for a question:

    I want to make a simple program that find files on the computer given the extension of the file:

    example : I have lost a text file and I forgot the name. So I launch my program and it will find all the .txt file on my computer.

    my problem is that I have no idea on how to do the search on the whole pc.

    I hope that i have well explained my problem...

    thanks all...

    by by..


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Search file program


  3. #3
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Search file program

    Check out - Java Code Snippets and Tutorials - Java Programming Forums

    There are lots of code snippets there.

    Take a look at this example:

    http://www.javaprogrammingforums.com...directory.html

    You can search for all .txt files in a given directory. This can be easily modified.
    I believe there is a .isDirectory() method. Use this to list the directories then list files within them.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  4. #4
    Junior Member
    Join Date
    Sep 2010
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Search file program

    Hi, thank you all !!!

    I have read all the information and now I have found a solution...

    by by..

  5. #5
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Search file program

    Quote Originally Posted by righi View Post
    Hi, thank you all !!!

    I have read all the information and now I have found a solution...

    by by..
    Good I have marked this thread as SOLVED. Let us know if you have any issues.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

Similar Threads

  1. Program that reads data from a text file...need help
    By cs91 in forum Java Theory & Questions
    Replies: 4
    Last Post: October 3rd, 2010, 07:57 AM
  2. search problem
    By farvi_buet in forum What's Wrong With My Code?
    Replies: 0
    Last Post: May 8th, 2010, 01:26 PM
  3. java program to copy a text file to onother text file
    By francoc in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: April 23rd, 2010, 03:10 PM
  4. google search
    By nasi in forum Java Theory & Questions
    Replies: 7
    Last Post: April 2nd, 2010, 03:13 AM
  5. Replies: 0
    Last Post: February 22nd, 2010, 01:21 AM