commons-user mailing list archives

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

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.

Ex:
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?

Thanks,

Eric

 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message