kdparson

Copy Multiple PDF output pages to a new folder in python

Discussion created by kdparson on May 25, 2012
Latest reply on May 28, 2012 by kdparson
I have to separate a large mapbook of individual pages (900+ pages) into separte folders but I need to retain the original files in the source folder.
There are 17 different folders. Also in another series I may have pages numbered 1, 14, 845.
Is there a better way instead of listing individual pages in the copy line for each folder?
Ideally I would like to do this by range so I can use it to another mapbook series that skips pages.
I am new to py scripting so any help is appreciated.


Many thanks, Kevin
#

import arcpy, os
from shutil import copy

# Code for mapbook in here

# Copy for Web A
inDir = r"C:\Work\City_Wide_Zoning\Mapbook\Mapbook\PDF\z_Grid\Test2"
outDir = r"C:\Work\City_Wide_Zoning\Mapbook\Mapbook\PDF\z_Grid\Test2\A"

copy(inDir + r"\1.pdf", outDir + r"\1.pdf")
copy(inDir + r"\14.pdf", outDir + r"\14.pdf")

# etc for Folder B, C, and so on

Outcomes