Thanks for the response. One of my coworkers came up with the following that seems to work.
import arcpy, os
path = os.curdir
PDFDir = os.path.join(path, "PDFs")
def ExportToPDF (fileName):
if not os.path.exists(PDFDir):
os.mkdir(PDFDir);
mxd = arcpy.mapping.MapDocument(os.path.join(path,fileName))
print mxd.filePath
if (hasattr(mxd, 'dataDrivenPages')):
print "*** Starting DDP export " + str(mxd.dataDrivenPages.pageCount) + " ***"
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
OutputPDFPath = os.path.join(PDFDir, fileName.replace(".mxd", "")) + str(pageNum) + ".pdf"
print OutputPDFPath
if os.path.exists(OutputPDFPath):
os.remove(OutputPDFPath)
mxd.dataDrivenPages.currentPageID = pageNum
arcpy.mapping.ExportToPDF(mxd, OutputPDFPath)
print pageNum
else:
OutputPDFPath = os.path.join(PDFDir, fileName.replace(".mxd", ".pdf"))
print OutputPDFPath
if os.path.exists(OutputPDFPath):
os.remove(OutputPDFPath)
return True
print path
for subdir, dirs, files in os.walk(path):
for file in files:
if (file.endswith(".mxd") == True):
print str(file)
ExportToPDF (file)