CURRENT_DIR=$(cd "$(dirname "$0")" || exit 1; pwd)
OUTPUT_FOLDER="${CURRENT_DIR}/输出"
SOURCE_FILE="${CURRENT_DIR}/1"
if [ ! -f "$SOURCE_FILE" ]; then
    echo -e "\033[31m❌ 错误：脚本当前目录下未找到文件1，请确认文件1路径：$SOURCE_FILE\033[0m"
    exit 1
fi
echo -e "\033[32m✅ 检测通过：文件1已找到\033[0m"
if [ -d "$OUTPUT_FOLDER" ]; then
    
    read -p $'\n\033[33m⚠️  输出文件夹已存在，是否清空原有文件？(y/n，默认n)：\033[0m' clear_confirm
    clear_confirm=${clear_confirm:-n}
    if [ "$clear_confirm" = "y" ] || [ "$clear_confirm" = "Y" ]; then
        rm -rf "${OUTPUT_FOLDER}"/*
        echo -e "\033[32m✅ 输出文件夹原有文件已清空\033[0m"
    else
        echo -e "\033[33mℹ️  保留输出文件夹原有文件，新文件将覆盖同名文件\033[0m"
    fi
else
    mkdir -p "$OUTPUT_FOLDER"
    echo -e "\033[32m✅ 输出文件夹不存在，已自动创建：$OUTPUT_FOLDER\033[0m"
fi
TARGET_NAMES=(
    "139f7ca4602884c210afd4193459d03b" "33b643f557f43d5b254340100d981d10"
    "350eef5300f19b90cb99babf6d97b038" "6800fb237e5eb16cd726bb9201b07051"
    "6f1f2da5655591f3e414f9cb2f637364" "8450181c81be27e448abc8b2eb24b49b"
    "9bb41bcd562fb5e08f8efbf064957d60" "d1f95cf4b3f8990d8b0444575a1fbb61"
    "2b3ee26822e44e9ee5fae90181d534d3" "33d6d44faa806c43197c2a92aabc7460"
    "59f95ac8c3555e4af9ef92cd881f0612" "6e0156c739f31797a89122c009afb3fb"
    "711e059443369ce055b46dc56f9cf40a" "864f05443816f3c3f9aa9b0fdceb7f38"
    "a26516845498fc100bbc825b7b68af7c" "bdb5cb02a2256317c81129c65d9e417b"
    "de97370724f88a85edd5866d2c3182c3" "ffc29f7b097133e8f3d39ee61269cb91"
   "1307d8cb164b1716150b1193661d419e" "43c0dd62e8ff2873ab30390dfff69bec"
    "453adf21a45ebd52f922bae31adfb2ce" "68db71d6258d3baed1064cb9d26dabe8"
    "712a425e67ea455e5c0e1a010f2beed2" "8aefdd285ef0b319c6c654cebe042c00"
    "984c5a0871c77b4be3f35e50b5562169" "a7cda6b5093f2ed4432a65fdfc1e3ae8"
    "df257341f217aa7c08d73cc0f0c1ee6d" "fc97d5aec6ecb8150a455e2bc5446966"
    "fdbf63af94954971ad1fea90533664d8" "08c12c2475fff37179438cc4f325f08f"
    "28c4eae03701eb484686d5b1d4f9c0e8" "368d5e16e8498530a4551a883b4d532d"
    "52a710e8c12b81f03f91b32a49e4b587" "685aacc44cfa18a28d38c4a07cbc1c9a"
    "7319d40ff352f0f743fb0337253366c3" "90c97b7b09f2921ba967bdac17e0633e"
   "a978a939e073614558b000d814a847a2" "e28867b2c4fd1f02db9d61427d8284ab"
    "3d0669e39a72cbcaffbf11e15e62c4ce" "461f2f063269ccd64880179ae909bd37"
    "4e014cdb4f6c86fb58fb53f03bf4a51b" "75a9e7dc45a1a4923e415068b2a27f97"
    "8f399605f7eaefc627b4ad657686403d" "919bfd8d9c899b8ccbeec86f25435864"
    "ae33b94972013f4dcaf978c9f2df79c5" "eb0529ed435d48cada1e8ccd524688a4"
    "0ba735da8cdf5051002edf4e081f4dac" "15af1123e6120451c93ddd34eb6f9568"
   "252418a57d99663ca1e3a88b74e583e7" "77fe6105888e1c96f2cae3eae8394140"
    "987c58e6d4ce229193e7c8664ef66ad9" "a67bcfa3f48e06d8f37206b57fbf85f9"
    "b91ada8a1edb5fc4351f6943e23f95d1" "e56bcefea38cb6bae624bbeedbef6a01"
    "ed7decac5bd9bf7f527508b4e52d95d2" "7e2deab32ce95d434b42639c74fdba12"
    "9a1a58aaf8002720b19a4cc5cecf28e0" "b99fb15b059585b2e437ff5b3690a676"
    "fc85adec013f896f21544c549fb35960" "059b9068b8d0d806a5e134fff970ce"
)
success=0
total=${#TARGET_NAMES[@]}
echo -e "\n🚀 开始执行批量复制，共需处理 $total 个文件"
for name in "${TARGET_NAMES[@]}"; do
    target_path="${OUTPUT_FOLDER}/${name}"
    cp -f "$SOURCE_FILE" "$target_path"
    if [ $? -eq 0 ]; then
        success=$((success + 1))
        echo -e "\033[32m✅ $success/$total 完成：$name\033[0m"
    else
        echo -e "\033[31m❌ $((success + 1))/$total 失败：$name\033[0m"
    fi
done
fail=$((total - success))
echo -e "\n🎉 执行结束！"
echo -e "\033[32m✅ 成功复制：$success 个文件\033[0m"
echo -e "\033[31m❌ 复制失败：$fail 个文件\033[0m"
echo -e "📂 所有文件已保存至输出目录：$OUTPUT_FOLDER"
