question: public static int delete ( File f ) throws IOException { int count = 0 ; if ( f . isFile ( ) ) { f . delete ( ) ; count ++ ; } else if ( f . isDirectory ( ) ) { File [ ] ff = f . listFiles ( ) ; if ( ff != null && ff . length > 0 ) { for ( File f1 : ff ) { count += delete ( f1 ) ; } } f . delete ( ) ; count ++ ; } return count ; }
target:  delete the file or the path