Delete all of a content type in Drupal 7

On a recent project, I had the need to delete thousands of a content type in order for me to correct some issues with the website, before re-adding them all. This is a useful script that I found to do just that. You fill in your content type, and all the nodes will be deleted. This works best in a custom module that you can turn on or off.

$node_types = array('content_type'); // add the machine names of node types you want to bulk delete

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
->propertyCondition('type', $node_types, 'IN');
$result = $query->execute();
foreach($result['node'] as $node){
node_delete($node->nid);
}