@Trivial
    private boolean deleteAll(File rootFile) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() ) {
            Tr.debug(tc, "Delete [ " + rootFile.getAbsolutePath() + " ]");
        }

        if ( FileUtils.fileIsFile(rootFile) ) {
            boolean didDelete = FileUtils.fileDelete(rootFile);
            if ( !didDelete ) {
                Tr.error(tc, "Could not delete file [ " + rootFile.getAbsolutePath() + " ]");
            } else {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() ) {
                    Tr.debug(tc, "Deleted");
                }
            }
            return didDelete;

        } else {
            boolean didDeleteAll = true;
            int deleteCount = 0;

            File childFiles[] = FileUtils.listFiles(rootFile);
            int childCount;
            if ( childFiles != null ) {
                childCount = childFiles.length;
                for ( File childFile : childFiles ) {
                    // Keep iterating even if one of the deletes fails.
                    // Delete as much as possible.
                    if ( !deleteAll(childFile) ) {
                        didDeleteAll = false;
                    } else {
                        deleteCount++;
                    }
                }
            } else {
                childCount = 0;
                deleteCount = 0;
            }

            if ( didDeleteAll ) {
                didDeleteAll = FileUtils.fileDelete(rootFile);
            }
            if ( !didDeleteAll ) {
                Tr.error(tc, "Could not delete directory [ " + rootFile.getAbsolutePath() + " ]");
            }

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() ) {
                Tr.debug(tc, "Deleted [ " + Integer.valueOf(deleteCount) + " ]" +
                             " of [ " + Integer.valueOf(childCount) + " ]");
            }

            return didDeleteAll;
        }
    }
@ Trivial private boolean deleteAll ( File rootFile ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Delete [ " + rootFile . getAbsolutePath ( ) + " ]" ) ; } if ( FileUtils . fileIsFile ( rootFile ) ) { boolean didDelete = FileUtils . fileDelete ( rootFile ) ; if ( ! didDelete ) { Tr . error ( tc , "Could not delete file [ " + rootFile . getAbsolutePath ( ) + " ]" ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Deleted" ) ; } } return didDelete ; } else { boolean didDeleteAll = true ; int deleteCount = 0 ; File childFiles [ ] = FileUtils . listFiles ( rootFile ) ; int childCount ; if ( childFiles != null ) { childCount = childFiles . length ; for ( File childFile : childFiles ) { if ( ! deleteAll ( childFile ) ) { didDeleteAll = false ; } else { deleteCount ++ ; } } } else { childCount = 0 ; deleteCount = 0 ; } if ( didDeleteAll ) { didDeleteAll = FileUtils . fileDelete ( rootFile ) ; } if ( ! didDeleteAll ) { Tr . error ( tc , "Could not delete directory [ " + rootFile . getAbsolutePath ( ) + " ]" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Deleted [ " + Integer . valueOf ( deleteCount ) + " ]" + " of [ " + Integer . valueOf ( childCount ) + " ]" ) ; } return didDeleteAll ; } }
a single consolidated wrapper.