wood burning stoves 2.0*
The moose likes Java in General and the fly likes How to use the FilenameFilter interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to use the FilenameFilter interface" Watch "How to use the FilenameFilter interface" New topic

How to use the FilenameFilter interface

kay lin
Ranch Hand

Joined: May 20, 2004
Posts: 132
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

plz let me know

Many thanks.
Elihu Smails
Ranch Hand

Joined: Jan 12, 2005
Posts: 37
Just write a class that implements FileFilter. Then create a method called accept that takes in a File object and returns a boolean. Inside this method, test the extension. If the extension is ".xml", return true, otherwise, return false.

This is all in the java tutorial...
I agree. Here's the link: http://aspose.com/file-tools
subject: How to use the FilenameFilter interface
Similar Threads
help moderator or site admin
using command "ls *.report" in java
How Do I Use FilenameFilter?
Couldn't check status of file/directory with casting error
++ with String.indexOf()