Delete Nodes From A Certain Date in Drupal

I wrote this snippet to clear out some nodes that I had imported that ended up being duplicates. I thought I would share.

$time = mktime(0,0,0,11,23,2011);

$result = db_query('SELECT * FROM node WHERE created > %d', $time);
while ($item = db_fetch_object($result)) {
  node_delete($item->nid);
}
comments powered by Disqus

© Balanced Scale Media, LLC. All right reserved.