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 3282620
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:56:54+00:00 2026-05-17T19:56:54+00:00

( background ) I’m using Java.io.File to do some windows directory searching. Basically the

  • 0

(background)
I’m using Java.io.File to do some windows directory searching. Basically the user inputs a directory path and I validate the path with file.isDirectory(). If the path is invalid I ask the user to re-enter a correct path. Once I get a valid directory I proceed with other File operations.

(problem)
Now the problem occurs when the user enters the root directory. For example, e:. In this case file.list() provides the following output [.classpath, .project, .settings, bin, src].
As you can see this does not include any folders.

However if he enters e:\ then file.list() fetches the existing directories also [$RECYCLE.BIN, <some directories>, <some files>, RECYCLER, System Volume Information]

This time we don’t have classpath, project etc. yet both e: and e:\ are considered valid directories.

1) Can someone explain this strange behavior?

2) Also, to avoid this problem is there a better method than adding a dirty manual check for x: and converting it into x:\?

  • 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-05-17T19:56:54+00:00Added an answer on May 17, 2026 at 7:56 pm

    First of all, .settings, bin and src ARE folders.
    Secondly, do you actually have those files (.classpath, .project, etc.) in drive e: ?

    My guess is, java doesn’t parse “e:” correctly, and file.list() gives you the list of files under the jvm current folder, which happens to be the folder where your eclipse project files reside (All those files AND folders that you mentioned belong to an eclipse project).

    Try opening a command-line window. On my machine it opens at c:\Windows\System32. Then type “cd c:” and see what happens …

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background: I'm using the (fantastic) Vim plugin python-mode , which includes the pep8 linter.
Background - I am using paramiko to put files on a bunch of remote
Background : I'm trying to convert some JavaScript code which uses the the Crossfilter
Background: Using unix, codeigniter from localhost. I'd like to run a controllers via a
Background - I want to extract specific columns from a csv file. The csv
Background: I have several builds running on a Windows Server 2003 R2 machine via
Background Windows 7 x 64 Python 2.7 Django 1.4 Celery with Redis bundle While
BACKGROUND I'm using VS 2010 on a machine where I installed .Net 4.5 which
Background This is only my second PyQt4 project. Developing a Windows app that has
Background My project is urgent and requires that I iterate a large XML file

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.