Remove the magento products using script

Remove all the magento products using script

function removeAllProducts(){
    $products = Mage :: getResourceModel('catalog/product_collection')->setStoreId(Mage_Core_Model_App::ADMIN_STORE_ID)->getAllIds();
    if(is_array($products))
    {
        foreach ($products as $key => $productId)
        {
            try
            {
                Mage::getModel('catalog/product')->load($productId)->delete();
                echo 'Product Removed '.$productId .PHP_EOL;

            }
            catch (Exception $e)
            {
                echo 'Failed to Remove product '.$productId .PHP_EOL;
            }
        }
    }
}

Share this Tutorial