#!/bin/bash
set -e
ROOT=/www/wwwroot/00002359.tech
D=/root/backup_20261103_pre_ra_tpl4
mkdir -p "$D/templates"
# 之前一次因為 $d 俾本地 shell 吞咗，備份跌咗喺 /templates；搬返入正路後刪走多餘目錄
if [ -d /templates ]; then
  cp -p /templates/master_ra_mec.docx /templates/master_ra_yec.docx "$D/templates/" 2>/dev/null || \
  cp -p "$ROOT/templates/master_ra_mec.docx" "$ROOT/templates/master_ra_yec.docx" "$D/templates/"
  rm -rf /templates
else
  cp -p "$ROOT/templates/master_ra_mec.docx" "$ROOT/templates/master_ra_yec.docx" "$D/templates/"
fi
ls -l "$D/templates"
md5sum "$D/templates"/*.docx
echo "--- web root 現況（未上載前應該係 Oct 29 舊檔）"
ls -l "$ROOT/templates/master_ra_mec.docx" "$ROOT/templates/master_ra_yec.docx"
md5sum "$ROOT/templates/master_ra_mec.docx" "$ROOT/templates/master_ra_yec.docx"
