commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Westerman <dlwes...@us.ibm.com>
Subject commons-io : FileFilters
Date Thu, 29 Oct 2009 14:15:45 GMT
I'm trying to use Apache Commons IO FileFilters, and it's obvious I don't 
clearly understand them, because I can't get them to work trying to find a 
subdirectory.

Here's my code:

File configCellDir = new File( FilenameUtils.concat( wasProfile , 
"config/cells" ) ) ;
IOFileFilter dmgrFilter = FileFilterUtils.nameFileFilter( "dmgr" ) ;
Collection dmgrDirs = FileUtils.listFiles( configCellDir , dmgrFilter , 
TrueFileFilter.INSTANCE ) ;


I'm trying to find a subdirectory 'dmgr' anywhere in the 
<WAS_PROFILE>/config/cells filesystem. The directory is definitely there, 
but the dmgrDirs collection is empty. I've also tried:
WildcardFileFilter dmgrFilter = new WildcardFileFilter( "*dmgr*" ) ;
and:
RegexFileFilter dmgrFilter = new RegexFileFilter( ".*dmgr.*" ) ;
All without success.

However, if I try to find a file, it works.

IOFileFilter serverIndexFilter = FileFilterUtils.nameFileFilter( 
"serverindex.xml" ) ;
Collection serverIndexFiles = FileUtils.listFiles( configCellDir , 
serverIndexFilter , TrueFileFilter.INSTANCE ) ;

Can anyone tell me what I'm doing wrong?

Thanks!
DLW

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message