[GIS] Seeking script or code to create map package

arcgis-10.0arcmaparcpymap-package

I am looking for some help or if someone has a script or tool to loop through a given folder of MXD's and Create MPK files with the same name.

i don t have so much experience of creating scripts , or using the Python window. I found ArcGIS 10 – need a tool/script to batch save multiple MXD files to layer package

where it details the Esri help page for data managment

I tried inputting the Python window code changing the code for my examples but I keep getting different error message.
I am not sure what i am doing wrong. I m not sure about setting up the parameters for an actual tool . i was wondering if maybe someone had already done this.

Best Answer

Take a look at this page:

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//0017000000q5000000

I gave you the 10.0 link based on your tag.

# Name: PackageMap.py
# Description:  Find all the map documents that reside in a specified folder and create map packages for each map document.
# import system modules
import os
import arcpy

from arcpy import env

# Set environment settings
env.overwriteOutput = True
env.workspace = "C:/arcgis/ArcTutor/Editing" 

# Loop through the workspace, find all the mxds and create a map package using the same name as the mxd
for mxd in arcpy.ListFiles("*.mxd"):
    print "Packaging " + mxd
    arcpy.PackageMap_management(mxd, os.path.splitext(mxd)[0] + '.mpk', "PRESERVE", "CONVERT_ARCSDE", "#", "ALL")