Mark Llobrera

Setting a destination directory for drush features-export

Drupal’s drush shell has a number of interesting uses, but when I’m working in Drupal 7 my primary use for it is to generate Features configuration exports for content types or views. Usually that means using drush fu (features-update) to quickly re-create an existing feature I’ve created using the admin UI. But a recent PHP memory usage lockup had me investigating if I could do this from the command line. Turns out it’s pretty easy. The form is

drush fe [feature name] [feature component]

For example,

drush fe amenities_view views_view:amenities

Doing that puts things into sites/all/modules. But what if you have your modules in a subfolder, say sites/all/modules/custom/features? Well, enter the --destination flag. So you can do:

drush fe amenities_view views_view:amenities --destination=sites/all/modules/custom/features

It appears that the --destination flag can be used for other drush commands as well, like downloading contrib modules. Something like:

drush dl admin_views --destination=sites/all/modules/contrib

This post by Mike Stiv has a lot of great examples for working with Features and drush.