public static void recursivelyDelete(File f) throws IOException {
        if (!f.exists()) {
            return;
        }
        if (f.isDirectory()) {
            for (File f1 : f.listFiles()) {
                recursivelyDelete(f1);
            }
            if (!f.delete()) {
                throw new IOException("Unable to delete directory " + f);
            }
        }
        else {
            if (!f.delete()) {
                throw new IOException("Unable to delete file " + f);
            }
        }
    }
public static void recursivelyDelete ( File f ) throws IOException { if ( ! f . exists ( ) ) { return ; } if ( f . isDirectory ( ) ) { for ( File f1 : f . listFiles ( ) ) { recursivelyDelete ( f1 ) ; } if ( ! f . delete ( ) ) { throw new IOException ( "Unable to delete directory " + f ) ; } } else { if ( ! f . delete ( ) ) { throw new IOException ( "Unable to delete file " + f ) ; } } }
/*
One of those why doesn't Java ship with this functions