The following code takes PDFs and appends them to a title page, creating a PDF MapBook. However, I can't figure out how to get the PDFs in the right order. I want the PDFs to be ordered by the month and year specified in the files (last 6 characters), rather than just alphabetical order of the whole file name. I am specifying the month using its numeric value (Example: CTDiscreteSumWithin4000_Avon_2017_5), I don't know whether than makes things easier or harder.
arcpy.env.workspace = r"C:\arcGIS_Shared\Python\Export\Discrete_CT"
path = r"C:\arcGIS_Shared\Python\Export\Discrete_CT"
### Create the PDF MapBook file
CTpdfPath = os.path.join(path, 'Avon_DiscreteHeatMaps.pdf')
CTpdfDoc = arcpy.mp.PDFDocumentCreate(CTpdfPath)
###List all files to be added to MapBook
CTpdfList = arcpy.ListFiles("CTDiscreteSumWithin4000_Avon*")
### Add market title page to the newly created PDF document
### Append market specific pages to the PDF
for CTpdf in CTpdfList:
Any help/advice would be appreciated. Thanks.