forked from pixelsdb/mini-pixels
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsync_files.sh
More file actions
executable file
·37 lines (27 loc) · 985 Bytes
/
sync_files.sh
File metadata and controls
executable file
·37 lines (27 loc) · 985 Bytes
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
#!/bin/bash
git remote add pixels-origin git@github.com:pixelsdb/pixels.git
git fetch pixels-origin
git checkout pixels-origin/master -- cpp
# 遍历当前目录下的所有文件和文件夹
for item in *; do
# 检查是否存在 cpp/ 对应的文件或文件夹
if [ -e "cpp/$item" ]; then
echo "Found matching item in cpp/: $item"
# 判断是文件还是目录
if [ -d "$item" ]; then
# 如果是目录,递归复制 cpp/ 目录下的内容到当前目录下的对应目录
echo "Syncing directory: $item"
cp -r cpp/"$item"/* "$item"/
elif [ -f "$item" ]; then
# 如果是文件,直接覆盖当前目录的文件
echo "Syncing file: $item"
cp cpp/"$item" "$item"
fi
else
echo "No matching item in cpp/ for: $item"
fi
done
rm -rf cpp
git add .
git commit -m "Auto-synced cpp directory from pixels repo"
git push origin master