diff --git a/clean_translations.py b/clean_translations.py index 4594a5f328..1ae147343c 100644 --- a/clean_translations.py +++ b/clean_translations.py @@ -5,21 +5,25 @@ files_in_main = [] files_in_main_include = [] -for i in os.listdir("_pages/en_US/"): - files_in_main.append(i) +for i in os.listdir("docs"): + if i.endswith(".md"): + files_in_main.append(i) -for i in os.listdir("_pages/en_US/include"): - files_in_main_include.append(i) +for i in os.listdir("docs/_include"): + if i.endswith(".md"): + files_in_main_include.append(i) -for i in os.listdir("_pages/"): - if i == "en_US": +for i in os.listdir("docs"): + if not os.path.isdir(f"docs/{i}"): continue - for j in os.listdir(f"_pages/{i}"): - if j == "include": - for k in os.listdir(f"_pages/{i}/include"): + if i in [".vitepress", "public", "_include", "_internal"]: + continue + for j in os.listdir(f"docs/{i}"): + if j == "_include": + for k in os.listdir(f"docs/{i}/_include"): if k not in files_in_main_include: - print(f"Deleting _pages/{i}/include/{k}") - os.remove(f"_pages/{i}/include/{k}") + print(f"Deleting docs/{i}/_include/{k}") + os.remove(f"docs/{i}/_include/{k}") elif j not in files_in_main: - print(f"Deleting _pages/{i}/{j}") - os.remove(f"_pages/{i}/{j}") + print(f"Deleting docs/{i}/{j}") + os.remove(f"docs/{i}/{j}")