This commit is contained in:
Para Dox
2025-04-27 17:53:05 +07:00
parent c3d5534520
commit ca59cb50eb

View File

@@ -64,6 +64,7 @@ for group_name in "${group_names[@]}"; do
# Use process substitution, awk for extraction/sorting, and readarray # Use process substitution, awk for extraction/sorting, and readarray
readarray -t sorted_bases < <( \ readarray -t sorted_bases < <( \
echo "$group_bases_str" | tr ' ' '\n' | \ echo "$group_bases_str" | tr ' ' '\n' | \
grep . | \
awk -F_ '{ awk -F_ '{
# Extract filename from full path if necessary # Extract filename from full path if necessary
split($0, path_parts, "/"); split($0, path_parts, "/");
@@ -138,20 +139,11 @@ for group_name in "${group_names[@]}"; do
for base in "${sorted_bases[@]}"; do for base in "${sorted_bases[@]}"; do
filename=$(basename "$base") # Get the basename filename=$(basename "$base") # Get the basename
# --- Add Debugging --- # --- Remove Debugging ---
echo "--- DEBUG ---"
echo "Current base: '$base'"
echo "Current filename (key): '$filename'"
echo "Keys currently in files_to_keep_basenames:"
printf " > '%s'\n" "${!files_to_keep_basenames[@]}" # Print keys one per line for clarity
echo "Array structure:"
declare -p files_to_keep_basenames
echo "Attempting check: [[ -z \"\${files_to_keep_basenames['$filename']+x}\" ]]"
echo "--- END DEBUG ---"
# --- End Debugging --- # --- End Debugging ---
# If the basename is NOT marked to be kept (key doesn't exist in files_to_keep_basenames), move it # If the basename is NOT marked to be kept (key doesn't exist in files_to_keep_basenames), move it
if [[ -z "${files_to_keep_basenames[$filename]+x}" ]]; then # <-- Line 141 (approx) if [[ -z "${files_to_keep_basenames[$filename]+x}" ]]; then # <-- Check using basename
files_to_move+=("$base") # Add the full base path to the list of files to move files_to_move+=("$base") # Add the full base path to the list of files to move
fi fi
done done