Skip to content

Commit

Permalink
Update 5-check_poc.sh
Browse files Browse the repository at this point in the history
poc目录可能不存在,增加代码容错性
  • Loading branch information
adysec authored Jan 21, 2025
1 parent 6cbd153 commit 9217c31
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions 5-check_poc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ TMP_DIR="tmp"
TIMEOUT=19800 # 设置超时时间为5小时30分钟
START_TIME=$(date +%s)

# 检查 POC 目录是否存在
# 检查 POC 目录是否存在,如果不存在则创建
if [ ! -d "$POC_DIR" ]; then
echo "POC 目录不存在,退出。"
exit 1
echo "POC 目录不存在,创建中..."
mkdir -p "$POC_DIR" || { echo "无法创建 POC 目录,退出。"; exit 1; }
echo "POC 目录已创建。"
fi

# 检查 TMP 目录是否存在
Expand Down Expand Up @@ -46,8 +47,11 @@ for file in $yaml_files; do
dest_file="$POC_DIR/$(echo "$file" | sed "s|$TMP_DIR/||")"
dest_dir=$(dirname "$dest_file")

# 创建目标目录
mkdir -p "$dest_dir"
# 创建目标目录(如果不存在)
if [ ! -d "$dest_dir" ]; then
echo "目标目录 $dest_dir 不存在,创建中..."
mkdir -p "$dest_dir" || { echo "无法创建目标目录,跳过 $file"; continue; }
fi

# 移动文件
mv "$file" "$dest_file" && echo "已将文件 $file 移动至 $dest_file"
Expand Down

0 comments on commit 9217c31

Please sign in to comment.