TYM666 commited on
Commit
b08f006
·
verified ·
1 Parent(s): 39bc93c

Delete update.py

Browse files
Files changed (1) hide show
  1. update.py +0 -35
update.py DELETED
@@ -1,35 +0,0 @@
1
- import os
2
- import shutil
3
-
4
- # 源文件夹
5
- jsons_dir = './!!jsons'
6
- refs_dir = './!!references'
7
-
8
- # 目标根目录
9
- target_root = './'
10
-
11
- # 获取所有 json 和 bib 文件对应的文件夹名(不含扩展名)
12
- json_files = {os.path.splitext(f)[0]: os.path.join(jsons_dir, f)
13
- for f in os.listdir(jsons_dir) if f.endswith('.json')}
14
-
15
- bib_files = {os.path.splitext(f)[0]: os.path.join(refs_dir, f)
16
- for f in os.listdir(refs_dir) if f.endswith('.bib')}
17
-
18
- # 合并所有要处理的文件夹名
19
- all_names = set(json_files.keys()) | set(bib_files.keys())
20
-
21
- for name in all_names:
22
- target_folder = os.path.join(target_root, name)
23
- os.makedirs(target_folder, exist_ok=True)
24
-
25
- # 复制并覆盖 meta.json
26
- if name in json_files:
27
- target_meta = os.path.join(target_folder, 'meta.json')
28
- shutil.copy2(json_files[name], target_meta)
29
-
30
- # 复制并覆盖 references.bib
31
- if name in bib_files:
32
- target_bib = os.path.join(target_folder, 'references.bib')
33
- shutil.copy2(bib_files[name], target_bib)
34
-
35
- print("同步完成,已替换目标文件夹中的旧文件(如果存在)。")