Created
August 1, 2012 12:47
-
-
Save AmyStephen/3226542 to your computer and use it in GitHub Desktop.
To create a .gitignore with a list of all files in Repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @package Molajo | |
* @copyright 2012 Amy Stephen. All rights reserved. | |
* @license GNU GPL v 2, or later and MIT, see License folder | |
* | |
* Place in the root of your website - execute it - and copy the results into your .gitignore | |
*/ | |
$current_path = __DIR__; | |
$objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($current_path), | |
RecursiveIteratorIterator::SELF_FIRST); | |
foreach($objects as $name => $object){ | |
if($object->isDir()) { | |
$dirRead = dir($name); | |
$path = $dirRead->path; | |
while (false !== ($entry = $dirRead->read())) { | |
if (is_dir($path . '/' . $entry)) { | |
} else { | |
$item = $path . '/' . $entry . '<br />'; | |
echo substr($item, strlen($current_path) + 1, 99999); | |
} | |
} | |
$dirRead->close(); | |
} | |
} | |
/** Current */ | |
$dirRead = dir(__DIR__); | |
$path = $dirRead->path; | |
while (false !== ($entry = $dirRead->read())) { | |
if (is_dir($path . '/' . $entry)) { | |
} else { | |
$item = $path . '/' . $entry . '<br />'; | |
echo substr($item, strlen($current_path) + 1, 99999); | |
} | |
} | |
$dirRead->close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Copy this file to the root of the website and execute it from a browser.
Copy the list into a gitignore file to have a complete list of all files in the primary repository that should be ignored during development of extensions.