public static boolean deleteFiles(String directoryPath){
  int filesDeletedCount=0;
  List<String> files=fileList(directoryPath,true);
  Iterator<String> filesIterator=files.iterator();
  while (filesIterator.hasNext()) {
    String file=filesIterator.next();
    deleteFile(file);
    filesDeletedCount++;
  }
  return (filesDeletedCount > 0 ? true : false);
}

public static boolean deleteFiles ( String directoryPath ) { int filesDeletedCount = 0 ; List < String > files = fileList ( directoryPath , true ) ; Iterator < String > filesIterator = files . iterator ( ) ; while ( filesIterator . hasNext ( ) ) { String file = filesIterator . next ( ) ; deleteFile ( file ) ; filesDeletedCount ++ ; } return ( filesDeletedCount > 0 ? true : false ) ; }
deletes files in a directory matching a specific pattern
