Created
June 17, 2014 22:50
-
-
Save tajo/5cb5ee8ee94aaae38af3 to your computer and use it in GitHub Desktop.
MergeEdux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
from PyPDF2 import PdfFileMerger, PdfFileReader | |
subs = ['BI-AAG','BI-APS','BI-BEZ','BI-CAO','BI-DBS','BI-EFA','BI-EIA','BI-GRA','BI-LIN','BI-MLO','BI-OSY','BI-PA1','BI-PA2','BI-PJP','BI-PSI','BI-PST','BI-SAP','BI-SI1','BI-VZD','BI-ZDM','BI-ZMA'] | |
folder = "okruhy" | |
# traverse root directory, and list directories as dirs and files as files | |
for sub in subs: | |
for root, dirs, files in os.walk(folder + "/" + sub): | |
merger = PdfFileMerger() | |
for pdfko in files: | |
if pdfko[-3:] == 'pdf': | |
merger.append(PdfFileReader(file(folder + "/" + sub + "/" + pdfko, 'rb'))) | |
print pdfko | |
merger.write(folder + "/" + sub + "/" + sub + "_all.pdf") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment