public static boolean deleteRecursive ( File path ) throws FileNotFoundException { if ( ! path . exists ( ) ) { throw new FileNotFoundException ( path . getAbsolutePath ( ) ) ; } boolean success = true ; if ( path . isDirectory ( ) ) { for ( File f : path . listFiles ( ) ) { success = success && FileUtils . deleteRecursive ( f ) ; } } return success && path . delete ( ) ; }
Delete all files rooted in the given path .