reading grouped annotations ; to and from tablette
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import sys
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
def sync_annotated(dir_arg):
|
||||
bgnot_dir = Path(dir_arg) / "BGnot"
|
||||
annotated_dir = Path.home() / "SyncCopies" / "Annotées"
|
||||
|
||||
if not annotated_dir.is_dir():
|
||||
print(f"Error: Directory {annotated_dir} does not exist.")
|
||||
return
|
||||
|
||||
# Iterate over all PDF files in the annotated directory
|
||||
for pdf_file in annotated_dir.glob("*.pdf"):
|
||||
subdir_name = pdf_file.stem # 'f' from 'f.pdf'
|
||||
target_subdir = bgnot_dir / subdir_name
|
||||
|
||||
if not target_subdir.is_dir():
|
||||
print(f"Warning: Directory {target_subdir} not found.")
|
||||
else:
|
||||
dest_file = target_subdir / "Concat_annotated.pdf"
|
||||
print("copying ", pdf_file, " to ", dest_file)
|
||||
shutil.copy2(pdf_file, dest_file)
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: python script.py <dir>")
|
||||
sys.exit(1)
|
||||
|
||||
sync_annotated(sys.argv[1])
|
||||
Reference in New Issue
Block a user