import os
BASE = os.path.dirname(os.path.abspath(__file__))
P2 = """2025-p2-maths-quiz-2-henry-park-pdf
2025-p2-maths-quiz-4_5_6-henry-park-pdf
2025-p2-maths-term-1-revision-rosyth-pdf
2025-p2-maths-term-1-revision-tao-nan-pdf
2025-p2-maths-term-2-revision-maha-bodhi-pdf
2025-p2-maths-term-2-revision-rosyth-pdf
2025-p2-maths-term-2-revision-tao-nan-pdf
2025-p2-maths-term-2-st-hilda-pdf
2025-p2-maths-term-3-revision-maha-bodhi-pdf
2025-p2-maths-term-3-revision-rosyth-pdf
2025-p2-maths-term-4-revision-1-rosyth-pdf
2025-p2-maths-term-4-revision-2-rosyth-pdf
2025-p2-maths-term-4-st-hilda-pdf
2024-p2-maths-quiz-1-and-2-raffles-girls-pdf
2024-p2-maths-quiz-1_2_3-raffles-girls-pdf
2024-p2-maths-quiz-1-henry-park-pdf
2024-p2-maths-quiz-2-henry-park-pdf
2024-p2-maths-quiz-3-henry-park-pdf
2024-p2-maths-quiz-4_5_6-henry-park-pdf
2024-p2-maths-quiz-4_5_6-raffles-girls-pdf
2024-p2-maths-quiz-7_8_9-raffles-girls-pdf
2023-p2-maths-quiz-1-henry-park-pdf
2023-p2-maths-quiz-1-scgs-pdf
2023-p2-maths-quiz-2-henry-park-pdf
2023-p2-maths-quiz-3-henry-park-pdf
2023-p2-maths-quiz-4-henry-park-pdf
2023-p2-maths-quiz-4-scgs-pdf
2023-p2-maths-review-1-nan-hua-pdf
2023-p2-maths-revision-1-raffles-girls-pdf
2023-p2-maths-revision-2-raffles-girls-pdf
2023-p2-maths-revision-3-raffles-girls-pdf
2023-p2-maths-revision-4-raffles-girls-pdf
2023-p2-maths-semestral-assessment-2-pei-hwa-pdf
2023-p2-maths-term-2-assessment-st-hilda-pdf
2023-p2-maths-term-2-revision-paper-chij-pdf
2023-p2-maths-term-3-revision-paper-chij-pdf
2023-p2-maths-term-4-assessment-st-hilda-pdf
2023-p2-maths-topical-review-1-maha-bodhi-pdf
2023-p2-maths-topical-review-2-maha-bodhi-pdf
2023-p2-maths-topical-review-3-maha-bodhi-pdf
2023-p2-maths-topical-test-2-nanyang-pdf
2022-p2-maths-bite-sized-assessment-3-acs-pdf
2022-p2-maths-checkpoint-1-and-3-catholic-high-pdf
2022-p2-maths-holistic-assessment-1-tao-nan-pdf
2022-p2-maths-holistic-assessment-2-tao-nan-pdf
2022-p2-maths-holistic-assessment-3-tao-nan-pdf
2022-p2-maths-learning-review-nan-chiau-pdf
2022-p2-maths-mini-test-1-rulang-pdf""".strip().splitlines()

outdir = os.path.join(BASE, "P2")
os.makedirs(outdir, exist_ok=True)
n = 0
for slug in P2:
    slug = slug.strip()
    if not slug:
        continue
    url = f"https://sgexam.com/subject/maths/{slug}/"
    fn = os.path.join(outdir, slug + ".url")
    with open(fn, "w", encoding="utf-8") as f:
        f.write("[InternetShortcut]\nURL=" + url + "\n")
    n += 1
print(f"wrote {n} .url files into P2/")
