Developer goodies: the delete all module to clean up thousands of nodes

Posted by: 
Dominique De Cooman

When you want to delete a lot of nodes or users you can use the delete all module in drupal. You have some handy drush commands:

  drush delete-all article              Delect all article nodes.
  drush delete-all all                   Delete nodes of all types.
  drush delete-all --reset             Delete nodes of all types, and reset node, revision and comment counters.
  drush delete-all users              Delete users.
 
Options:
 --reset                              Reset counter for node, revision and comment tables.
 --roles                              pick roles
 
Aliases: da

As you can see you can delete nodes by type, users by role.

You can even reset node counters. but then you must delete all nodes.

There is also a quick method available which does not use node_delete but deletes everything with a single SQL statement. Performs a lot better.

Project page:
http://drupal.org/project/delete_all

Add new comment