AnsweredAssumed Answered

Deleting MXDs after PDFs are Created!

Question asked by MLCouden on Feb 27, 2013
Latest reply on Feb 28, 2013 by MLCouden
I have a program that places the PDFs of each mxd in the same folder. This is fine. I just need the mxds to be deleted (after the creation of the PDF)  or I need the PDFs put into a seperate folder away from the mxds. Code is below :

import arcpy, os
folderPath = r"C:\2 - GEO-DATA PROCESSING SUPPORT\Permanent Site Maps\2_District MXDs"
for filename in os.listdir(folderPath):
    fullpath = os.path.join(folderPath, filename)
    if os.path.isfile(fullpath):
        basename, extension = os.path.splitext(fullpath)
        if extension.lower() == ".mxd":
            mxd = arcpy.mapping.MapDocument(fullpath)
            arcpy.mapping.ExportToPDF(mxd, basename + '.pdf')