#!/bin/bash # 创建软链接脚本 # 将本地data目录中的文件链接到NAS SOURCE_ROOT="/Users/chufeng/.openclaw/sanguo_projects/sanguo_quant_live/zhaoyun-data/data/" TARGET_ROOT="/Users/chufeng/nas/stock-data/sanguo_quant_live/zhaoyun-data/data/" echo "🚀 开始创建软链接..." echo " 源目录: $SOURCE_ROOT" echo " 目标目录: $TARGET_ROOT" # 创建目录结构 find "$SOURCE_ROOT" -type d | while read dir; do target_dir="$TARGET_ROOT$dir" mkdir -p "$target_dir" echo " 创建目录: $target_dir" done # 创建文件软链接 count=0 find "$SOURCE_ROOT" -type f | while read file; do target_file="$TARGET_ROOT$file" target_dir=$(dirname "$target_file") mkdir -p "$target_dir" rm -f "$target_file" ln -s "$file" "$target_file" count=$((count+1)) if [ $((count % 100)) -eq 0 ]; then echo " 已创建 $count 个软链接..." fi done echo "✅ 软链接创建完成!" echo " 总计: $count 个软链接" echo