File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes get list of folders Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "get list of folders " Watch "get list of folders " New topic

get list of folders

aymane chetibi
Ranch Hand

Joined: Apr 12, 2006
Posts: 175
hello all,
i have an application that gets the list of folders in a specific folder and then gets all the files within each folder.

How can I do that please.
thanks alot!
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24195

The class has a list() method and a listFiles() method, either of which can list the contents of a directory. There's also an isDirectory() method to tell you which Files are actually Directories.

[Jess in Action][AskingGoodQuestions]
aymane chetibi
Ranch Hand

Joined: Apr 12, 2006
Posts: 175
thanks a lot
I agree. Here's the link:
subject: get list of folders
It's not a secret anymore!