Skip to content

Commit 8674803

Browse files
committed
file strcture changes
1 parent 3cc7846 commit 8674803

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

scripts/cleanup.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,22 @@
22
import re
33

44
# Paths
5-
base_dir = os.path.dirname(os.path.abspath(__file__))
6-
labs_dir = os.path.join(base_dir, 'labs')
7-
readme_path = os.path.join(base_dir, 'README.md')
5+
base_dir = os.path.dirname(os.path.abspath(__file__)) # /scripts
6+
repo_root = os.path.abspath(os.path.join(base_dir, "..")) # repo root
7+
labs_dir = os.path.join(repo_root, 'labs')
8+
readme_path = os.path.join(repo_root, 'README.md')
9+
10+
# 0. Safety checks
11+
if not os.path.exists(readme_path):
12+
print(f"README not found at {readme_path}, skipping cleanup.")
13+
exit(0)
14+
15+
if not os.path.exists(labs_dir):
16+
print(f"Labs directory not found at {labs_dir}, skipping cleanup.")
17+
exit(0)
818

919
# 1. Remove files named "tmp" or "tnp" with no extension
10-
for root, dirs, files in os.walk(base_dir):
20+
for root, dirs, files in os.walk(repo_root):
1121
for file in files:
1222
if file in ('tmp', 'tnp'):
1323
file_path = os.path.join(root, file)

0 commit comments

Comments
 (0)