Wwangzhitong发布 4.24
d2f67737创建于 2024年9月12日历史提交
#!/bin/bash

add_large_files_to_lfs() {
    local directory="$1"

    for file in "$directory"/*; do
        if [ -f "$file" ]; then
            file_size=$(stat -f %z "$file")

            if [ "$file_size" -gt $((5 * 1024 * 1024)) ]; then
                git lfs track "$file"
            fi
        elif [ -d "$file" ]; then
            add_large_files_to_lfs "$file"  # 递归调用,继续查找子目录
        fi
    done
}

# 定义目录路径
directory_path="UniMPSDK"

# 清空 .gitattributes 文件
echo "" > .gitattributes
# 添加大文件到 Git LFS
add_large_files_to_lfs "$directory_path"