Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Deleting MXDs after PDFs are Created!

$
0
0
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')
os.remove(path)

Viewing all articles
Browse latest Browse all 2485

Latest Images

Trending Articles



Latest Images