Support BGnot in giving_names

master
Sébastien Miquel 2026-03-03 18:23:01 +01:00
parent 9acdb66bab
commit 6222ba5dac
1 changed files with 5 additions and 4 deletions

View File

@ -5,11 +5,12 @@ import re
from collections import defaultdict
def main():
if len(sys.argv) < 2:
print("Usage: python giving_names.py <directory_path>")
if len(sys.argv) < 3:
print("Usage: python giving_names.py <directory_path> <Bnot/BGnot>")
sys.exit(1)
work_dir = os.path.abspath(sys.argv[1])
bnot_dir = os.path.abspath(sys.argv[2])
target_subdir = os.path.join(work_dir, "A Rendre")
os.makedirs(target_subdir, exist_ok=True)
@ -42,7 +43,7 @@ def main():
safe_name = re.sub(r'[<>:"/\\|?*]', '', name).strip()
for copie_id in ids:
path_b = os.path.join(work_dir, f"Bnot/Copie{copie_id}")
path_b = os.path.join(work_dir, f"{bnot_dir}/Copie{copie_id}")
path_a = os.path.join(work_dir, f"Anot/Copie{copie_id}")
# Determine source: must contain both files
@ -58,7 +59,7 @@ def main():
source_folder = path_a
if not source_folder:
print(f"Skipping ID {copie_id}: Files missing in both Anot and Bnot.")
print(f"Skipping ID {copie_id}: Files missing in both Anot and {bnot_dir}.")
continue
# Create destination directory