File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes getting files in a directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "getting files in a directory" Watch "getting files in a directory" New topic
Author

getting files in a directory

Phil Chuang
Ranch Hand

Joined: Feb 15, 2003
Posts: 251
How would I get all the files in a directory? Equivalent to doing a dir *.* ... ?
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Look into java.io.File list method. You may want to write a java.io.FilenameFilter to select the files you want out of the directory.
Let us know if those are enough clues to go on, or if you'd like some samples.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Phil Chuang
Ranch Hand

Joined: Feb 15, 2003
Posts: 251
Yah I found it, I was looking for the wrong type of object at first, then I peeked in the File definition and found everything I needed
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getting files in a directory