public static void deleteFilesByRegex ( File dir , String regex ) { if ( regex == null ) { throw new DataUtilException ( "Filename regex can not be null" ) ; } FilenameFilter filter = new RegexFilenameFilter ( regex ) ; FileDeleter . deleteFiles ( dir , filter ) ; }
Delete files in a directory matching a regular expression