public void clearTempFiles ( boolean preserveZipFile ) { //delete the temp sql file File sqlFile = new File ( dirName + "/sql/" + sqlFileName ) ; if ( sqlFile . exists ( ) ) { boolean res = sqlFile . delete ( ) ; logger . debug ( LOG_PREFIX + ": " + sqlFile . getAbsolutePath ( ) + " deleted successfully? " + ( res ? " TRUE " : " FALSE " ) ) ; } else { logger . debug ( LOG_PREFIX + ": " + sqlFile . getAbsolutePath ( ) + " DOES NOT EXIST while clearing Temp Files" ) ; } File sqlFolder = new File ( dirName + "/sql" ) ; if ( sqlFolder . exists ( ) ) { boolean res = sqlFolder . delete ( ) ; logger . debug ( LOG_PREFIX + ": " + sqlFolder . getAbsolutePath ( ) + " deleted successfully? " + ( res ? " TRUE " : " FALSE " ) ) ; } else { logger . debug ( LOG_PREFIX + ": " + sqlFolder . getAbsolutePath ( ) + " DOES NOT EXIST while clearing Temp Files" ) ; } //only execute this section if the //file is not to be preserved if ( ! preserveZipFile ) { //delete the zipFile File zipFile = new File ( zipFileName ) ; if ( zipFile . exists ( ) ) { boolean res = zipFile . delete ( ) ; logger . debug ( LOG_PREFIX + ": " + zipFile . getAbsolutePath ( ) + " deleted successfully? " + ( res ? " TRUE " : " FALSE " ) ) ; } else { logger . debug ( LOG_PREFIX + ": " + zipFile . getAbsolutePath ( ) + " DOES NOT EXIST while clearing Temp Files" ) ; } //delete the temp folder File folder = new File ( dirName ) ; if ( folder . exists ( ) ) { boolean res = folder . delete ( ) ; logger . debug ( LOG_PREFIX + ": " + folder . getAbsolutePath ( ) + " deleted successfully? " + ( res ? " TRUE " : " FALSE " ) ) ; } else { logger . debug ( LOG_PREFIX + ": " + folder . getAbsolutePath ( ) + " DOES NOT EXIST while clearing Temp Files" ) ; } } logger . debug ( LOG_PREFIX + ": generated temp files cleared successfully" ) ; }
This function will delete all the temp files generated ny the library unless it s otherwise instructed not to do so by the preserveZipFile variable