Drupal File Upgrade Bash Script

Replacing files during a Drupal upgrade can be tedious, especially for those of us who have to worry about SVN files in every directory. The following script automates this part of the Drupal upgrade, making it much faster and less error prone. I've been using the script in its current form for almost a year and it has served me well. And though most of my other bash scripts have been replaced by Drush commands, this script has proven better suited to my workflow than its Drush equivalent.

Overview

The script does the following:

Deletes the current Drupal distribution files while preserving:

directories

SVN files

all files in the /sites directory tree

all files in /files directory tree(I have a number of sites using the old file directory location)

the Komodo (.kpf) project file

Downloads and expands the Drupal distribution tarball if it has not already been done

One thing this script doesn't do is remove unused directories. On the few occasions directories are removed from a release I remove them manually, and in my experience there's no harm done when I've missed one. The overall time savings is well worth this small manual detail.

Usage

Exact usage will depend on how you set up scripts on your system. I have a scripts directory in my path, so the script is treated like a command.

Once you placed the script on your system, you'll need to create a directory for the Drupal distributions and update the script's SOURCE_DIRECTORY variable with the location.

Drush has built in support for updates, and saves you from reinventing the wheel. Drush has the same functionalities as your script, but in addition it can also update modules. It also verifies the MD5 sums and backs up the old files so you can roll back if needed.

When it comes to upgrading Drupal core I think you missed this statement in my introduction: "this script has proven better suited to my workflow than its Drush equivalent". If it's working for your workflow I'm a little envious and hope you post a description of how you use it. I'm curious to see if I've misunderstood or missed something.