Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8610459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:08:04+00:00 2026-06-12T04:08:04+00:00

So I am writing a code that locates certain information on Protein databases. I

  • 0

So I am writing a code that locates certain information on Protein databases. I know that a recursive folder search is the best possible way to locate these files, but I am very new to this language and have been told to write in Java (I normally do C++)

SO this being said, what method would i use to:

First: Locate the folder on desktop
Second: Open each folder and that folders subfolders
Third: Locate files that end with the “.dat” type (because these are the only files that have stored the Protein information

Thanks for any and all help you can provide

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:08:06+00:00Added an answer on June 12, 2026 at 4:08 am
    1. java.io.File is “An abstract representation of file and directory pathnames”
    2. File.listFiles provides a listing of all the files contained within the directory (if the File object represents a directory)
    3. File.listFiles(FileFilter) provides you with the ability to filter a file list based on your needs

    So, with that information…

    You would specify a path location with something like…

    File parent = new File("C:/path/to/where/you/want");
    

    You can check that the File is a directory with…

    if (parent.isDirectory()) {
        // Take action of the directory
    }
    

    You can list the contents of the directory by…

    File[] children = parent.listFiles();
    // This will return null if the path does not exist it is not a directory...
    

    You can filter the list in a similar way…

    File[] children = parent.listFiles(new FileFilter() {
            public boolean accept(File file) {
                return file.isDirectory() || file.getName().toLowerCase().endsWith(".dat");
            }
        });
    // This will return all the files that are directories or whose file name ends
    // with ".dat" (*.dat)
    

    Other useful methods would include (but not limited to)

    • File.exists to test that the file actually exists
    • File.isFile, basically instead of saying !File.isDirectory()
    • File.getName(), returns the name of the file, excluding it’s path
    • File.getPath() returns the path and name of the file. This can be relative, so be careful, see File.getAbsolutePath and File.getCanonicalPath to resolve this.
    • File.getParentFile which gives you access to the parent folder
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing code that parses XML. I would like to know what is
I am writing code that will spawn two thread and then wait for them
I am writing code that catches this OutOfMemoryException and throws a new, more intuitive
I'm using c#. In many cases I'm writing code that can benefit from a
I am a very proficient C# developer, but need to start writing code that
I'm writing some code that will take a screenshot of another application, given its'
I am writing some code that will go through a file, edit it as
I'm writing a code that uses bitboards. since iterating on all bits of a
I'm writing some code that has a lot of substitution. There's a list<char> productions
I am writing some code that connects to a website, and using C#, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.