This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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 Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to use the FilenameFilter interface" Watch "How to use the FilenameFilter interface" New topic
Author

How to use the FilenameFilter interface

kay lin
Ranch Hand

Joined: May 20, 2004
Posts: 132
Hi:
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
Couldn't check status of file/directory with casting error
How Do I Use FilenameFilter?
++ with String.indexOf()
using command "ls *.report" in java
help moderator or site admin