Published by Richard on Thu, 08/11/2011 - 18:51
category:
Today I had over 1,000 nodes to remove from a Drupal 6 installation. The bulk update only lets you remove 50 nodes at a time. What to do?
My Situation
All the node were from a certain content type. Actually, I need to remove all node that belonged to a particular content type. Lets call this content type "articles" My Solution Use PHP to remove all the node that belong to that node type. First I activated the PHP filter Then I ran this PHP script
$node_type = 'story';
//get the nodes we need
$result = db_query("SELECT nid FROM {node} WHERE type='%s'",$node_type);
while ($row = db_fetch_object($result)){
node_delete($row->nid);
$deleted_count+=1;
}
//debug message
drupal_set_message("$deleted_count nodes have been deleted");