public void clean ( ) { final Path bPath = FileSystems . getDefault ( ) . getPath ( basePath ) ; for ( int i = 0 ; i < 3 ; i ++ ) { try { final CleanUpFileVisitor visitor = new CleanUpFileVisitor ( ) ; Files . walkFileTree ( bPath , visitor ) ; if ( ! visitor . hasErrors ( ) ) { print ( "Deleted " + basePath ) ; return ; } else if ( useLogger && logger . isDebugEnabled ( ) ) { for ( final Throwable t : visitor . getErrors ( ) ) { logger . debug ( "Could not delete files/directories." , t ) ; } } } catch ( final Exception e ) { print ( e . getMessage ( ) + " Retring to delete it." ) ; try { Thread . sleep ( 1000 ) ; } catch ( final InterruptedException ignore ) { // ignore } } } print ( "Failed to delete " + basePath + " in this process." ) ; }
Delete all configuration files and directories .