Remove unneeded directories.