question: public static void deleteDirectoryRecursively ( Context context , File f , Boolean onlyContent ) throws IOException { if ( f . isDirectory ( ) ) { for ( File c : f . listFiles ( ) ) { deleteDirectoryRecursively ( context , c , false ) ; } } if ( ! onlyContent ) { if ( ! f . delete ( ) ) { throw new IOException ( "Failed to delete file: " + f ) ; } context . sendBroadcast ( new Intent ( Intent . ACTION_MEDIA_SCANNER_SCAN_FILE , Uri . parse ( "file://" + f . getAbsolutePath ( ) ) ) ) ; } }
target:  Delete a directory recursively