File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Software Craftsman
this week in the
Java in General
how to get all the files that have the same extension in a directory
Joined: May 20, 2004
Jan 26, 2005 10:57:00
I am just wondering, is there any API function I can call that would return me an array/enumeration of all the files in this directory as well as the sub directory that has the same extension
I am in C:\test directory,
I would like to have a list of files that ends in .xml in the C:\test directory as well as its subdirectory.
Please let me know
Joined: Jan 12, 2005
Jan 26, 2005 11:00:00
and java.io.FileFilter. You must create a
and pass it in to the File.listFiles method. This will give you your listing of the files that you want.
Joined: Dec 06, 2003
Jan 26, 2005 11:25:00
FileIterator I wrote
might help you if you need to search subdirectories as well. If not, File#listFiles(FilenameFilter filter) is the better choice.
Have you tried LearnNowOnline?
subject: how to get all the files that have the same extension in a directory
What name to use to save files; what classes are allowed?
How to use the FilenameFilter interface
Executing files....mp3 style
Setting up JAVA
PATH & CLASSPATH?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015