public static void delete ( final File file , final boolean ignoreFailures ) { if ( file . isDirectory ( ) ) { final File [ ] files = file . listFiles ( ) ; if ( null != files ) { for ( final File f : files ) { delete ( f , ignoreFailures ) ; } } } if ( ! file . delete ( ) && ! ignoreFailures ) { try { Files . delete ( file . toPath ( ) ) ; } catch ( final IOException ex ) { LangUtil . rethrowUnchecked ( ex ) ; } } }
Recursively delete a file or directory tree .