new era
This commit is contained in:
@@ -93,8 +93,8 @@ for group_name in "${group_names[@]}"; do
|
|||||||
filename=$(basename "$base")
|
filename=$(basename "$base")
|
||||||
if [[ "$filename" == *"_0_499999" ]]; then
|
if [[ "$filename" == *"_0_499999" ]]; then
|
||||||
# Check if the key for this base path is already set in files_to_keep
|
# Check if the key for this base path is already set in files_to_keep
|
||||||
# Use -v for safe check with set -u
|
# Use parameter expansion ${key+x} for safe check with set -u (Bash 4.0+)
|
||||||
if ! [[ -v files_to_keep[$base] ]]; then
|
if [[ -z "${files_to_keep[$base]+x}" ]]; then
|
||||||
echo "Marking first range '$filename' to keep for group '$group_name'."
|
echo "Marking first range '$filename' to keep for group '$group_name'."
|
||||||
files_to_keep["$base"]=1 # Mark this base path for keeping
|
files_to_keep["$base"]=1 # Mark this base path for keeping
|
||||||
first_range_kept=true
|
first_range_kept=true
|
||||||
@@ -121,8 +121,8 @@ for group_name in "${group_names[@]}"; do
|
|||||||
base="${sorted_bases[$i]}" # Get the base path from the sorted array
|
base="${sorted_bases[$i]}" # Get the base path from the sorted array
|
||||||
filename=$(basename "$base")
|
filename=$(basename "$base")
|
||||||
# Mark for keeping only if it hasn't been marked already (e.g., by Rule 1)
|
# Mark for keeping only if it hasn't been marked already (e.g., by Rule 1)
|
||||||
# Use -v for safe check with set -u
|
# Use parameter expansion ${key+x} for safe check with set -u (Bash 4.0+)
|
||||||
if ! [[ -v files_to_keep[$base] ]]; then
|
if [[ -z "${files_to_keep[$base]+x}" ]]; then
|
||||||
echo " - $filename"
|
echo " - $filename"
|
||||||
files_to_keep["$base"]=1 # Mark this base path for keeping
|
files_to_keep["$base"]=1 # Mark this base path for keeping
|
||||||
else
|
else
|
||||||
@@ -138,8 +138,8 @@ for group_name in "${group_names[@]}"; do
|
|||||||
# Iterate through all sorted base paths for the group
|
# Iterate through all sorted base paths for the group
|
||||||
for base in "${sorted_bases[@]}"; do
|
for base in "${sorted_bases[@]}"; do
|
||||||
# If a base path is NOT marked to be kept (key doesn't exist in files_to_keep), move it
|
# If a base path is NOT marked to be kept (key doesn't exist in files_to_keep), move it
|
||||||
# Use -v for safe check with set -u
|
# Use parameter expansion ${key+x} for safe check with set -u (Bash 4.0+)
|
||||||
if ! [[ -v files_to_keep[$base] ]]; then
|
if [[ -z "${files_to_keep[$base]+x}" ]]; then
|
||||||
files_to_move+=("$base") # Add base path to the list of files to move
|
files_to_move+=("$base") # Add base path to the list of files to move
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user