public void cleanup(boolean deleteAll){
  long currentTime=System.currentTimeMillis();
  File file=new File(getOutputDirectoryString());
  if (file.isDirectory()) {
    File[] files=file.listFiles();
    for (int i=0; i < files.length; i++) {
      File f=files[i];
      if (!deleteAll) {
        try {
          long ft=getTimeForFileName(f.getName());
          long tdiff=currentTime - ft;
          if (DEBUG) {
            Debug.output("MagicPlanetImageComponent considering deleting " + f.getName() + ", file time:"+ ft+ ", current time:"+ currentTime+ ", interval:"+ getCleanupInterval()+ ", diff:"+ tdiff);
          }
          if (tdiff > getCleanupInterval()) {
            if (DEBUG)             Debug.output("   deleting...");
            f.delete();
          }
        }
 catch (        NumberFormatException nfe) {
        }
      }
 else {
        f.delete();
      }
    }
  }
}

public void cleanup ( boolean deleteAll ) { long currentTime = System . currentTimeMillis ( ) ; File file = new File ( getOutputDirectoryString ( ) ) ; if ( file . isDirectory ( ) ) { File [ ] files = file . listFiles ( ) ; for ( int i = 0 ; i < files . length ; i ++ ) { File f = files [ i ] ; if ( ! deleteAll ) { try { long ft = getTimeForFileName ( f . getName ( ) ) ; long tdiff = currentTime - ft ; if ( DEBUG ) { Debug . output ( "MagicPlanetImageComponent considering deleting " + f . getName ( ) + ", file time:" + ft + ", current time:" + currentTime + ", interval:" + getCleanupInterval ( ) + ", diff:" + tdiff ) ; } if ( tdiff > getCleanupInterval ( ) ) { if ( DEBUG ) Debug . output ( "   deleting..." ) ; f . delete ( ) ; } } catch ( NumberFormatException nfe ) { } } else { f . delete ( ) ; } } } }
remove old files . checks the current time against the timestamps decoded by the names of files found in the output directory , and deletes them if the difference between those times is greater than the cleanupinterval .
