|
@@ -4,7 +4,7 @@
|
|
|
// www.dbmxpca.com
|
|
// www.dbmxpca.com
|
|
|
// Date Created: May 18, 2020
|
|
// Date Created: May 18, 2020
|
|
|
// Last Updated: May 19, 2020
|
|
// Last Updated: May 19, 2020
|
|
|
-// Version: 2.00
|
|
|
|
|
|
|
+// Version: 2.01
|
|
|
|
|
|
|
|
// ====================================================================================
|
|
// ====================================================================================
|
|
|
// --- SETTINGS --- SETTINGS --- SETTINGS --- SETTINGS --- SETTINGS --- SETTINGS ---
|
|
// --- SETTINGS --- SETTINGS --- SETTINGS --- SETTINGS --- SETTINGS --- SETTINGS ---
|
|
@@ -228,9 +228,19 @@ if ($enable_dir_scan_preview){
|
|
|
echo " ================================\n";
|
|
echo " ================================\n";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+$total_items_original = count($contents);
|
|
|
|
|
+// Account for zero-based indexing.
|
|
|
|
|
+if ($total_items_original > 0)
|
|
|
|
|
+ $total_items_original++;
|
|
|
|
|
+
|
|
|
|
|
+echo " > A total of " . $total_items_original . " files and directories were discovered.\n";
|
|
|
|
|
+
|
|
|
$content_map = array();
|
|
$content_map = array();
|
|
|
$content_map_new = array();
|
|
$content_map_new = array();
|
|
|
|
|
|
|
|
|
|
+echo " > Creating base content map, please wait...\n";
|
|
|
|
|
+$script_time_start = microtime(true);
|
|
|
|
|
+
|
|
|
// V2 Update: Build a content map with ONLY the path, while
|
|
// V2 Update: Build a content map with ONLY the path, while
|
|
|
// honoring the $skip_directory setting. The content map will
|
|
// honoring the $skip_directory setting. The content map will
|
|
|
// be roughly the same if $skip_directories is false but should
|
|
// be roughly the same if $skip_directories is false but should
|
|
@@ -240,8 +250,9 @@ foreach ($contents as $c){
|
|
|
switch($skip_directories){
|
|
switch($skip_directories){
|
|
|
|
|
|
|
|
case true:
|
|
case true:
|
|
|
- if (!is_dir($c))
|
|
|
|
|
|
|
+ if (!is_dir($c)){
|
|
|
array_push($content_map, $c);
|
|
array_push($content_map, $c);
|
|
|
|
|
+ }
|
|
|
break;
|
|
break;
|
|
|
default:
|
|
default:
|
|
|
array_push($content_map, $c);
|
|
array_push($content_map, $c);
|
|
@@ -249,6 +260,17 @@ foreach ($contents as $c){
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+$script_time_end = microtime(true);
|
|
|
|
|
+$script_runtime = $script_time_end - $script_time_start;
|
|
|
|
|
+
|
|
|
|
|
+echo " > Base content map creation complete [" . $script_runtime . " ms].\n";
|
|
|
|
|
+$total_items_old = count($content_map);
|
|
|
|
|
+// Account for zero-based indexing.
|
|
|
|
|
+if ($total_items_old > 0)
|
|
|
|
|
+ $total_items_old++;
|
|
|
|
|
+
|
|
|
|
|
+echo " > A total of " . $total_items_old . " item(s) remain, after filtering based on script directory-skip settings.\n";
|
|
|
|
|
+
|
|
|
// Instead of copying the entire array, we'll add to it as necessary later.
|
|
// Instead of copying the entire array, we'll add to it as necessary later.
|
|
|
// $content_map_new = $content_map;
|
|
// $content_map_new = $content_map;
|
|
|
|
|
|
|
@@ -321,7 +343,7 @@ foreach ($content_map_new as $old => $new){
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-echo "\n >>> A total of " . $total_items . " item(s) will be renamed. <<<\n\n";
|
|
|
|
|
|
|
+echo "\n >>> A total of " . $total_items . " item(s) will be renamed if you continue. <<<\n\n";
|
|
|
|
|
|
|
|
if ($total_items > 0){
|
|
if ($total_items > 0){
|
|
|
|
|
|