20

Is there a way to make Drush download modules into a specified folder besides sites/all/modules (e.g. sites/all/contrib, sites/all/core)?

If this makes a difference, I am using Drush 4.4.

  • 1
    I think instead of sites/all/contrib, you wanted to write sites/all/modules/contrib, right? ;) Btw., sites/all/modules/core doesn't really make sense, because core modules (which MUSTN'T get hacked) simply get into modules directory, and they do not get downloaded later - they just get updated on a regular Drupal update. – Sk8erPeter Oct 6 '13 at 11:19
14

I've not tried it but apparently.

drush help dl

--destination Path to which the project will be copied. If you're providing a relative path, note it is relative to the drupal root (if bootstrapped).

  • 2
    For sites/all/contrib you just need to crate this dir, drush will recognize it and use for all contrib modules – sobi3ch Jun 25 '15 at 8:53
23

You can default this to, for example, sites/all/modules/contrib, in your .drush/drushrc.php file.

$command_specific['dl'] = array('destination' => 'sites/all/modules/contrib'); 

Also note that you won't be able to exclude the 'modules' part of the path, as Drupal uses this to scan for modules.

There are 6 places this file can live:

  1. Drupal site folder (e.g. sites/{default|example.com}/drushrc.php).
  2. Drupal /drush and sites/all/drush folders, or the /drush folder in the directory above the Drupal root.
  3. In any location, as specified by the --config (-c) option.
  4. User's .drush folder (i.e. ~/.drush/drushrc.php).
  5. System wide configuration folder (e.g. /etc/drush/drushrc.php).
  6. Drush installation folder.
  • 3
    Thanks for posting it as a separate answer. This is the real answer for defining the default download directory as I said earlier. :) +1 for that. (Btw. I hope the OP will change the accepted answer to this one. ;) ) – Sk8erPeter Oct 10 '13 at 10:57
  • 1
    For sites/all/contrib you just need to crate this dir, drush will recognize it and use for all contrib modules. For different dir use above answer with drushrc.php settings. – sobi3ch Jun 25 '15 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.