public static void deleteDirectory(File dir) {
        if (!dir.exists()) {
            return;
        }

        if (dir.isDirectory()) {
            for (File child : dir.listFiles()) {
                deleteDirectory(child);
            }
            dir.delete();
        } else {
            dir.delete();
        }
    }
public static void deleteDirectory ( File dir ) { if ( ! dir . exists ( ) ) { return ; } if ( dir . isDirectory ( ) ) { for ( File child : dir . listFiles ( ) ) { deleteDirectory ( child ) ; } dir . delete ( ) ; } else { dir . delete ( ) ; } }
Deletes given directory (and does not reason about symlinks). If the
given directory does not exist, this method does nothing.

@param dir
Directory to delete