Index: modules/update/update.manager.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/update/update.manager.inc,v
retrieving revision 1.26
diff -u -r1.26 update.manager.inc
--- modules/update/update.manager.inc	20 Nov 2010 09:40:34 -0000	1.26
+++ modules/update/update.manager.inc	23 Nov 2010 12:13:43 -0000
@@ -654,6 +654,16 @@
   if (!$archiver) {
     throw new Exception(t('Cannot extract %file, not a valid archive.', array ('%file' => $file)));
   }
+
+  // Remove the directory if it exists, otherwise it will contain a mixture of old
+  // outdated files mixed with the shiny new files.
+  $files = $archiver->listContents();
+  $project = drupal_substr($files[0], 0, -1);
+  $extract_location = $directory . '/' . $project;
+  if (file_exists($extract_location)) {
+    file_unmanaged_delete_recursive($extract_location);
+  }
+
   $archiver->extract($directory);
   return $archiver;
 }
