Create Folder During Install Module in Magento 1.7 and 1.8

magento-1.7magento-1.8

So, I create module, which implement import/export some data. Everything work fine. The logic of import in next : I take a file in var/[module_name]/import/. (This file will be put by some another service)

My question is: What is the best way to create this folders [module_name]/import when some one will take my module in other project?

I think about to write instruction ('create folder in var…'), and also I think about installer, but I guess it is not good idea

Any advice?

Best Answer

If you have a separate extension for import/export just add this in the install script of you extension:

$io = new Varien_Io_File();
$io->checkAndCreateFolder(Mage::getBaseDir('var').DS.'[module_name]'.DS.'import');

It will create the folder with 777 permissions.

Related Topic