public static boolean deleteFile ( final File file ) { // delete directory content recursively if ( file . isDirectory ( ) ) { final File [ ] children = file . listFiles ( ) ; for ( File child : children ) { if ( ! deleteFile ( child ) ) { return false ; } } } // delete file/empty directory return file . delete ( ) ; }
delete file or directory