Files
pragativeer-v2/remove_links.py

25 lines
885 B
Python

import os
import re
dir_path = r"c:\Users\naman\OneDrive\Desktop\pragativeer-v2\src\app\dashboard\ai-coach"
# Pattern to remove
pattern = re.compile(
r'\s*<Link href="/dashboard/ai-coach" className="inline-flex items-center gap-2 text-sm font-bold text-\[#00F0FF\] hover:underline mb-2">\s*<ArrowLeft size=\{16\} /> Back to AI Coach Overview\s*</Link>',
re.MULTILINE | re.DOTALL
)
for root, dirs, files in os.walk(dir_path):
for file in files:
if file == "page.tsx":
path = os.path.join(root, file)
with open(path, "r", encoding="utf-8") as f:
content = f.read()
new_content = pattern.sub('', content)
if new_content != content:
with open(path, "w", encoding="utf-8") as f:
f.write(new_content)
print(f"Updated {path}")