David Lohmeyer's Blog

Quickly upgrade Drupal core: only different files

Here's a handy commandline snippet that will help you upgrade Drupal core (for example, 6.19 to 6.20) without having to replace everything.  It will only update the files that have changed.

  • Navigate to Drupal site root.
  • wget <drupal tar.gz URL>
  • tar -xzvf <drupal tar.gz file>
  • cd <new extracted folder>
  • \cp -Rvupf * ../

The cp command there recursively goes through the new extracted folder and copies it into the folder structure above the folder you're in (into your Drupal site root).  It only updates changed files.  It will also tell you which files are copied over.  So long painful upgrades!  Be sure to visit the admin page after for database updates.

Note that this will most likely not work from one major release to another such as Drupal 6 to Drupal 7.

UPDATE 5/27/11: This technique works on both Drupal 6 and Drupal 7 sites to new point releases.  The above bolded comment still likely stands... though I have not tested it.

UPDATE 8/8/11: Upgrading Drupal on a Mac? Unfortunately the Mac's cp command does not include the update (-u) flag. To do it, follow all of the instructions above and use rsync instead: rsync -ur * ../

Related Posts