-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremove_duplicates.py
More file actions
27 lines (22 loc) · 1001 Bytes
/
Copy pathremove_duplicates.py
File metadata and controls
27 lines (22 loc) · 1001 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
import os
root = r'C:\Users\hyper\workspace\bg\bobsgameonlinejava'
src_main = os.path.join(root, 'src', 'main', 'java')
others = [
os.path.join(root, 'client', 'src', 'main', 'java'),
os.path.join(root, 'shared', 'src', 'main', 'java'),
os.path.join(root, 'server', 'src', 'main', 'java')
]
for dirpath, dirnames, filenames in os.walk(src_main):
for filename in filenames:
if filename.endswith('.java'):
full_path = os.path.join(dirpath, filename)
rel_path = os.path.relpath(full_path, src_main)
# Special case: KEEP the puzzle files I just wrote in src/main/java
if 'com\\bobsgame\\puzzle' in rel_path:
continue
for other in others:
other_full = os.path.join(other, rel_path)
if os.path.exists(other_full):
print(f"Deleting duplicate: {rel_path}")
os.remove(full_path)
break