Skip to content

Instantly share code, notes, and snippets.

@Shagshag
Created July 10, 2015 10:29
Show Gist options
  • Save Shagshag/9034cf0f1912490d6e49 to your computer and use it in GitHub Desktop.
Save Shagshag/9034cf0f1912490d6e49 to your computer and use it in GitHub Desktop.
<?php
$file_content = '<?php
/**
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please refer to http://doc.prestashop.com/display/PS15/Overriding+default+behaviors
* #Overridingdefaultbehaviors-Overridingamodule%27sbehavior for more information.
*
* @author Samdha <[email protected]>
* @copyright Samdha
* @license commercial license see license.txt
*/
';
$dir = 'C:\Users\Georges\Documents\Boulot\Prestashop\mes modules\deliverydays';
function createIndex($dir, $file_content)
{
$file_name = $dir.DIRECTORY_SEPARATOR.'index.php';
if (!file_exists($file_name)) {
file_put_contents($file_name, $file_content);
echo $file_name.' '.PHP_EOL;
}
$sub_dirs = scandir($dir);
foreach ($sub_dirs as $sub_dir) {
if ($sub_dir[0] != '.' && is_dir($dir.DIRECTORY_SEPARATOR.$sub_dir)) {
createIndex($dir.DIRECTORY_SEPARATOR.$sub_dir, $file_content);
}
}
}
createIndex($dir, $file_content);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment