Magento Dataflow Export/Import form the command line

One issue with Magento is the overhead involved in importing/exporting data which can cause timeouts when run from the web. Here is a script which will run from the command line….

//THIS SCRIPT JUST INITIALS THE PROFILE TO BE RUN VIA MAGENTO ADMIN "RUN PROFILE IN POPUP". Its the same thing as click just via this file that you can run via cron
$profileId = 8; // SYSTEM - IMPORT/EXPORT - ADVANCED PROFILES <-- you need to go into your magento admin and grab the exact profile ID
require_once 'app/Mage.php';
$profile = Mage::getModel('dataflow/profile');
$userModel = Mage::getModel('admin/user');
if (!$profile->getId()) {
    Mage::getSingleton('adminhtml/session')->addError('ERROR: Incorrect profile id');
Mage::register('current_convert_profile', $profile);
$recordCount = 0;
$batchModel = Mage::getSingleton('dataflow/batch');
echo "EXPORT COMPLETE. BATCHID: " . $batchModel->getId();