How to Mass Delete Nodes In Drupal

Here is a sample code to delete a node or mass delete nodes in Drupal

$node_type = ‘page';
$rsquery = db_query(“SELECT n.nid FROM {node} n WHERE n.type = ‘%s’ limit 100″, $node_type);
set_time_limit(0);

while ($n = db_fetch_object($rsquery)) {
node_delete($n->nid);
}