Module Development

Movie Project: Create a Drush Command for Drupal 7

Check your version

This tutorial covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Create a custom Drush command, which makes use of re-usable functions within our Movie Import module.


Create a custom Drush command that will run a movie import function in our custom module.


You will need the following knowledge and skills. If you need a review, check out the Additional resources section at the bottom of this page.

  1. How to create a custom Drush command for importing content.


Write a Drush command in the movie_import custom module, which imports all the films defined in the variable created in the .install file.

Write a Drush command which deletes all movies in the website.


  • Drush commands allow us to run time-consuming processes without timing out.
  • Drush commands can be used within shell scripts, for example to manage releases of Drupal.

Further your understanding

Additional resources

Creative Commons License

Drupal Training Resources by Damian Robinson are licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Based on a work at

Hands-On Exercises: Movie Project