commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric B." <>
Subject [IO] How to use IOFileFilter to filter against a complete directory path?
Date Tue, 13 Apr 2010 14:58:18 GMT

I'm trying to use FileUtils.iterateFile() with a FolderFilter to filter 
against certain directories I want to list.  Furthermore, I am trying to use 
RegExs to specify which folders I want filtered.  My problem, however, is 
that the RegexFilter only filters against the relative foldername and not 
the entire folder name.

Iterator<File> filesIterator = FileUtils.iterateFiles( new File( folder ), 
fileFilter, folderFilter );

where folder = c:\dev\projects\TestProject.

In this case, the RegexFileFilter will only check against "TestProject" and 
not "c:\dev\projects\TestProject".

I can obviously extend the RegexFileFilter and override the accept() method, 
but was wondering if there wasn't another "cleaner" way of doing this rather 
than creating my own custom filter.  I surprised that there is no default / 
defacto way of checking against the entire path as opposed to just the 
relative dir name.

Has anyone run across this before?




To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message