private int removeRecursive(final File basePath,final int numFiles){
  int numLogsDeleted=0;
  try {
    if (basePath.isDirectory()) {
      if (Cfg.DEBUG) {
        Check.log(TAG + " (removeRecursive): " + basePath.getName());
      }
      final File[] fileLogs=basePath.listFiles();
      for (      final File file : fileLogs) {
        final int removed=removeRecursive(file,numFiles - numLogsDeleted);
        numLogsDeleted+=removed;
      }
    }
    if (!basePath.delete()) {
      if (Cfg.DEBUG) {
        Check.log(TAG + " (removeRecursive) Error: " + basePath.getAbsolutePath());
      }
    }
 else {
      numLogsDeleted+=1;
    }
  }
 catch (  final Exception e) {
    if (Cfg.EXCEPTION) {
      Check.log(e);
    }
    if (Cfg.DEBUG) {
      Check.log(TAG + " Error: removeLog: " + basePath+ " ex: "+ e);
    }
  }
  if (Cfg.DEBUG) {
    Check.log(TAG + " removeLogRecursive removed: " + numLogsDeleted);
  }
  return numLogsDeleted;
}

private int removeRecursive ( final File basePath , final int numFiles ) { int numLogsDeleted = 0 ; try { if ( basePath . isDirectory ( ) ) { if ( Cfg . DEBUG ) { Check . log ( TAG + " (removeRecursive): " + basePath . getName ( ) ) ; } final File [ ] fileLogs = basePath . listFiles ( ) ; for ( final File file : fileLogs ) { final int removed = removeRecursive ( file , numFiles - numLogsDeleted ) ; numLogsDeleted += removed ; } } if ( ! basePath . delete ( ) ) { if ( Cfg . DEBUG ) { Check . log ( TAG + " (removeRecursive) Error: " + basePath . getAbsolutePath ( ) ) ; } } else { numLogsDeleted += 1 ; } } catch ( final Exception e ) { if ( Cfg . EXCEPTION ) { Check . log ( e ) ; } if ( Cfg . DEBUG ) { Check . log ( TAG + " Error: removeLog: " + basePath + " ex: " + e ) ; } } if ( Cfg . DEBUG ) { Check . log ( TAG + " removeLogRecursive removed: " + numLogsDeleted ) ; } return numLogsDeleted ; }
removes the log recursive .
