<?phprequire_once('app/Mage.php'); umask(0); Mage::app('admin'); $productCollection = Mage::getModel('catalog/product') ->getCollection();foreach($productCollection as $_product) { $productID = $_product->getId(); try { $mediaApi = Mage::getModel("catalog/product_attribute_media_api"); $items = $mediaApi->items($productID); foreach($items as $item) { $mediaApi->remove($productID, $item['file']); // this will remove images } Mage::getModel("catalog/product")->load($productID)->delete(); // this will delete product } catch (Exception $exception){ var_dump($exception); die('Exception Thrown'); } }