Batch module replace in Drupal

Every so often I update a Drupal site and need to update a bunch of modules/themes at the same time. Fortunately, the naming convention of modules/themes is consistent so I can update many with one little script.
First, scp all the module/theme gz files to the location you want to store them. Next, cd into that directory. Last, run this script:

for thm in $(ls *.gz)
do
        thmnew=$(ls ${thm}|cut -d'-' -f1)
        tar -cf ${thmnew}_old.tar ${thmnew}
        mv ${thmnew}_old.tar /usr/local/src/drupal/tmp/themesupgraded/
        mv ${thmnew} /usr/local/src/drupal/tmp/themesupgraded/
        tar -zxvf ${thm}
        mv ${thm} /usr/local/src/drupal/tmp/themesupgraded/
done

Comments

Popular posts from this blog

Database, schema, and table sizes in Greenplum

Greenplum update with multiple tables

Show running queries on Postgresql/Greenplum