Skip to content

Instantly share code, notes, and snippets.

@emanoelopes
Created June 19, 2023 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emanoelopes/59c5fc1a3ed2d961aabe1c9a357fc901 to your computer and use it in GitHub Desktop.
Save emanoelopes/59c5fc1a3ed2d961aabe1c9a357fc901 to your computer and use it in GitHub Desktop.
Concatenate sorted by name pdf files from multiples directory
from pypdf import PdfMerger
import os, glob
originais = sorted(glob.glob("/home/emanoel/Documentos/cadernos_samuel/originais/*/*.pdf", recursive=True))
merger = PdfMerger()
for pdf in originais:
merger.append(pdf)
merger.write("caderno-samuel.pdf")
merger.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment