How to delete a node or a list of nodes with Drush? I discovered the Delete all module which gives you the ability to delete all the nodes of a given content type. However, with this module you can't delete a single node or a list of nodes.

In the question "Can I delete nodes of a given content type with Drush?" I found 2 answers talking about the command drush node_delete &lt;nid&gt; but I can't find this command.

I found in a discussion about node_delete() some code using eval to accomplish this task, but it is using eval:

drush php-eval "global \$user; \$user = user_load(1); node_delete(nid);"


In case that there doesn't exist a functionality implemented to accomplish this, what is the better way to implement this functionality: in the Drush module or create a new module?
Finally I create my own module named drush_delete

Inside the drush_delete.drush.inc file put this code:

&lt;?php
/**
 * @file
 * The Drush Delete drush commands.
 */

/**
* Implements hook_drush_command().
*/
function drush_delete_drush_command() {
  $items['node-delete'] = array(
    'description' =&gt; dt("Delete nodes."),
    'aliases' =&gt; array('nd'),
    'arguments' =&gt; array(
      'nids' =&gt; dt('The nids of the nodes to delete'),
    ),
    'examples' =&gt; array(
      'drush node-delete 1' =&gt; dt('Delete the node with nid = 1.'),
      'drush node-delete 1 2 3' =&gt; dt('Delete the nodes with nid = 1, 2 and 3.'),

    ),
  );
  return $items;
}

/**
 * Callback for the node-delete command
 */
function drush_drush_delete_node_delete() {
  $nids = func_get_args();
  $nids = array_filter($nids, 'is_numeric');
  $nids = array_map('intval', $nids);
  $nids = array_unique($nids);
  $nids = array_values($nids);
  $cant = count($nids);

  if ($cant &gt; 0) {
    node_delete_multiple($nids);

    drush_print(dt("Deleted nodes:"));
    drush_print(implode(' ', $nids));
  }
  else {
    drush_set_error('DRUSH_ERROR_CODE', dt("You must enter at least one nid"));
  }
}


Install the module, run drush cc drush to clear the drush cache and use the command like this:

To delete a node use:

drush node-delete 1
drush nd 1


To delete multiple nodes use:

drush node-delete 1 2 3
drush nd 1 2 3


You can found the command in this module: 

https://github.com/adrian-cid/drush_commands