• 批量另存低版本MXD


    要点:

    1. arcpy.mapping.MapDocument(路径)

    2.os.sep表示  ;os.path.basename(i)表示带路径的文件名

     1 import sys
     2 import os
     3 import arcpy
     4 
     5 paths=r'D:	est01mxd版本另存.mxd'
     6 out=r'D:	est01mxd低版本'
     7 ver=10
     8 
     9 mxd = arcpy.mapping.MapDocument(paths)
    10 mxd.saveACopy(out+os.sep+os.path.basename(paths),ver)
     1 import sys
     2 import os
     3 import arcpy
     4 
     5 paths=arcpy.GetParameterAsText(0)
     6 out=arcpy.GetParameterAsText(1)
     7 ver=arcpy.GetParameterAsText(2)
     8 
     9 mxd = arcpy.mapping.MapDocument(paths)
    10 mxd.saveACopy(out+os.sep+os.path.basename(paths),ver)
     1 import sys
     2 import os
     3 import arcpy
     4 
     5 list = [r'D:	est01mxd版本另存.mxd', r'D:	est01mxd版本另存2.mxd', r'D:	est01mxd子文件版本另存3.mxd']
     6 out=r'D:	est01mxd低版本'
     7 ver=10
     8 
     9 for i in list:
    10     mxd = arcpy.mapping.MapDocument(i)
    11     print i
    12     mxd.saveACopy(out+os.sep+os.path.basename(i),ver)
     1 import sys
     2 import os
     3 import arcpy
     4 
     5 list = arcpy.GetParameterAsText(0)
     6 out=arcpy.GetParameterAsText(1)
     7 ver=arcpy.GetParameterAsText(2)
     8 
     9 for i in list:
    10     mxd = arcpy.mapping.MapDocument(i)
    11     mxd.saveACopy(out+os.sep+os.path.basename(i),ver)
     1 import os
     2 import arcpy
     3 
     4 fileDir=r'D:	est02四川省'
     5 out =r'D:	est02四川省另存'
     6 ver=10.0
     7 
     8 for root,dirs,files in os.walk(fileDir):
     9         for f in files:
    10                 outdir=root.replace(fileDir,out)
    11                 print outdir+os.sep+f
     1 import os
     2 import arcpy
     3 
     4 fileDir=r'D:	est02四川省'
     5 out =r'D:	est02四川省另存'
     6 ver=10
     7 
     8 for root,dirs,files in os.walk(fileDir):
     9         for f in files:
    10                 outroot=root.replace(fileDir, out)
    11                 if os.path.isdir(outroot):
    12                         print
    13                 else:
    14                         os.mkdir(outroot)
    15 
    16                 print '输入:'+root+os.sep+f
    17                 mxd = arcpy.mapping.MapDocument(root+os.sep+f)
    18                 print '输出:'+outroot+os.sep+f
    19                 mxd.saveACopy(outroot+os.sep+f,ver)
    20                 
     1 import os
     2 import arcpy
     3 
     4 fileDir=arcpy.GetParameterAsText(0)
     5 out =arcpy.GetParameterAsText(1)
     6 ver=arcpy.GetParameterAsText(2)
     7 
     8 for root,dirs,files in os.walk(fileDir):
     9         for f in files:
    10                 outroot=root.replace(fileDir, out)
    11                 if os.path.isdir(outroot):
    12                         print
    13                 else:
    14                         os.mkdir(outroot)
    15                 mxd = arcpy.mapping.MapDocument(root+os.sep+f)
    16                 mxd.saveACopy(outroot+os.sep+f,ver)
    17                 arcpy.AddMessage('output:'+outroot+os.sep+f)
    18                 
  • 相关阅读:
    二十三、java连接oracle数据库操作:jdbc
    四、正则表达式使用
    Linux常用命令大全
    消息队列的常见问题
    JVM:带你查看常见的问题,以及分析处方法
    JVM监控与调优
    缓存总结2
    缓存总结1
    消息队列mq总结
    Java集合Map基本方法
  • 原文地址:https://www.cnblogs.com/gistwz/p/7928086.html
Copyright © 2020-2023  润新知