The following code snippet deletes empty directory.

Java Code:
boolean success = (new File(dir)).delete();

        if (success) {
            System.out.println("Successfully deleted empty directory: " + dir);
        } else {
            System.out.println("Failed to delete empty directory: " + dir);
        }