Created
November 6, 2013 12:06
-
-
Save grahambates/7335051 to your computer and use it in GitHub Desktop.
Delete any unused Drupal module directories. Assumes '/sites/all/modules/contrib' etc. directory structure, hence depth of 5. Change this if required. Removes any directories that contain no enabled modules, taking into account sub-modules.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drush sqlq "SELECT DISTINCT SUBSTRING_INDEX(filename , '/', 5) dir | |
FROM system | |
WHERE status = 0 | |
AND type = 'module' | |
AND filename NOT LIKE 'modules/%' | |
HAVING dir NOT IN ( | |
SELECT SUBSTRING_INDEX(filename , '/', 5) | |
FROM system | |
WHERE status = 1 | |
);" | xargs rm -rf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment