|
|
@@ -5,13 +5,33 @@
|
|
|
// Date Created: May 18, 2020
|
|
|
// Last Updated: May 18, 2020
|
|
|
|
|
|
+// ====================================================================================
|
|
|
+// --- SETTINGS --- SETTINGS --- SETTINGS --- SETTINGS --- SETTINGS --- SETTINGS ---
|
|
|
+// ====================================================================================
|
|
|
+
|
|
|
+// If true, the script will search for all possible occurrences of itself
|
|
|
+// and remove it from the directory traversal so as to prevent any alter-
|
|
|
+// ations to the script itself. This can be useful but for larger dir-
|
|
|
+// ectory traversals can consume a significant amount of time. It is rec-
|
|
|
+// ommended that this is enabled only for small datasets or if time is
|
|
|
+// not of significant concern.
|
|
|
+$remove_self = false;
|
|
|
+
|
|
|
+// If true, directories will be skipped and thus will not be renamed.
|
|
|
+$skip_directories = true;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// ====================================================================================
|
|
|
+// +++++++++++ DO NOT EDIT BEYOND THIS POINT +++++++++++ DO NOT EDIT BEYOND THIS POINT
|
|
|
+// ====================================================================================
|
|
|
+
|
|
|
+
|
|
|
$dirToTraverse = -1;
|
|
|
$regex_search = "";
|
|
|
$replace_str = "";
|
|
|
$thisFile = __DIR__ . "/" . $argv[0];
|
|
|
|
|
|
-// ======================================================================
|
|
|
-
|
|
|
function GET_DIR_CONTENTS($dir, &$results = array()) {
|
|
|
$files = scandir($dir);
|
|
|
|
|
|
@@ -115,10 +135,13 @@ else{
|
|
|
$contents = array();
|
|
|
GET_DIR_CONTENTS($dirToTraverse, $contents);
|
|
|
|
|
|
-while( ($found = array_search($thisFile, $contents)) !== false ){
|
|
|
+if ($remove_self){
|
|
|
|
|
|
- echo " > Removing this script from file listing.\n";
|
|
|
- unset($contents[$found]);
|
|
|
+ while( ($found = array_search($thisFile, $contents)) !== false ){
|
|
|
+
|
|
|
+ echo " > Removing this script from file listing.\n";
|
|
|
+ unset($contents[$found]);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// var_dump($contents);
|