magento delete order programmatically

Orders id

require 'app/Mage.php';
Mage::app('admin')->setUseSessionInUrl(false);
//replace your own orders numbers here:
$test_order_ids = array(
	'100100210',
	'100100211',
	'100100212',
	'100100248',

);
foreach ($test_order_ids as $id) {
	try {
		Mage::getModel('sales/order')->loadByIncrementId($id)->delete();
		echo "order #" . $id . " is removed" . PHP_EOL;
	} catch (Exception $e) {
		echo "order #" . $id . " could not be remvoved: " . $e->getMessage() . PHP_EOL;
	}
}
echo "complete.";


Date range 

delete order programmatically magento 

/**
 * Delete Orders
 *
 */
require 'app/Mage.php';
Mage::app('admin')->setUseSessionInUrl(false);

$dateFrom = '01/01/2015';
$dateTo = '30/01/2015';

$fromDate = Mage::app()->getLocale()->date($dateFrom)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
$toDate = Mage::app()->getLocale()->date($dateTo)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);

$orderCollection = Mage::getModel('sales/order')->getCollection()
            ->addAttributeToFilter('created_at', array('date' => true, 'from' => $fromDate))
            ->addAttributeToFilter('created_at', array('date' => true, 'to' => $toDate));

# echo $orderCollection->printLogQuery(true);

if ($orderCollection->count()) {
    foreach ($orderCollection as $order) {
        try {
            Mage::getModel('sales/order')->loadByIncrementId($order->getIncrementId())->delete();
            echo "Order #" . $id . " is removed" . PHP_EOL;
            Mage::log("Order #" . $id . " is removed", null, "order-delete.log");
        } catch (Exception $e) {
            echo "Order #" . $id . " could not be remvoved: " . $e->getMessage() . PHP_EOL;
            Mage::log("Order #" . $id . " could not be remvoved: " . $e->getMessage(), null, "order-delete.log");
        }
    }
    echo "
"; echo "Completed."; Mage::log("Completed.", null, "order-delete.log"); }