File dir = new File("."); FileFilter fileFilter = new WildcardFilter("*test*.java~*~"); File[] files = dir.listFiles(fileFilter); for (int i = 0; i < files.length; i++) { System.out.println(files[i]); }@author Jason Anderson @version $Revision: 155419 $ $Date: 2005-02-26 13:02:41 +0000 (Sat, 26 Feb 2005) $ @since Commons IO 1.1
WildcardFilter
is used to match Strings against wildcards. It performs matches with "*", i.e. "jms.events.*" would catch "jms.events.customer" and "jms.events.receipts". This filter accepts a comma-separated list of patterns, so more than one filter pattern can be matched for a given argument: "jms.events.*, jms.actions.*" will match "jms.events.system" and "jms.actions" but not "jms.queue".
a001.dat a005.dat a5.dat a_old.dat b.datexample 1:
a#.dat finds a001.dat a005.dat a5.datexample 2:
a*.dat finds a001.dat a005.dat a5.dat a_old.dat@author Martin Senne, Jan-Hendrik Prinz
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|