-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopy.sh
40 lines (31 loc) · 873 Bytes
/
copy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/bash
function copy_folder {
local source_folder=$1
local target_folder=$2
mkdir -p "$target_folder/$source_folder"
#echo "$target_folder/$source_folder"
cp -rf "$source_folder/." "$target_folder/$source_folder"
}
function is_windows() {
if [[ $(uname) == "MINGW"* || $(uname) == "CYGWIN"* ]]; then
return 0 # 返回 true
else
return 1 # 返回 false
fi
}
echo 复制依赖文件 ...
source_folders=("templates/dist" "lib")
# set lib 777
if is_windows; then
chmod -R 777 "lib"
else
sudo chmod -R 777 "lib"
fi
prefix="Caj2Pdf-Gin_"
# shellcheck disable=SC2207
target_folders=($(find ./dist -maxdepth 1 -type d -name "${prefix}*"))
for target_folder in "${target_folders[@]}"; do
for source_folder in "${source_folders[@]}"; do
copy_folder "$source_folder" "$target_folder"
done
done