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