Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
How to use the FilenameFilter interface
Joined: May 20, 2004
Jan 26, 2005 11:32:00
This is regarding my previous post,
if I want to include all the xml files in a directy and its sub directory
, say C:\test,
do i just do the following
FilenameFilter ff = FilenameFilter.accept(new File ("c:\test"), "*.xml"); //then pass in the filter, to get all the with xml extension File file = new File("C:\test"); file.listFiles(ff);
plz let me know
Joined: Jan 12, 2005
Jan 26, 2005 11:56:00
Just write a class that implements
. Then create a method called accept that takes in a File object and returns a boolean. Inside this method,
the extension. If the extension is ".xml", return true, otherwise, return false.
This is all in the
It is sorta covered in the
JavaRanch Style Guide
subject: How to use the FilenameFilter interface
help moderator or site admin
How Do I Use FilenameFilter?
using command "ls *.report" in java
++ with String.indexOf()
Couldn't check status of file/directory with casting error
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013