Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with open('data.csv', 'wb') as csvfile:
- fieldnames = ['File_Path', 'File_Size(MB)', 'Last_Edit', 'MXD_Version', 'Author', 'PageSize',
- 'XMAX', 'XMIN', 'YMAX', 'YMIN', 'DATASOURCE'] #all the header fields
- writer = csv.DictWriter(csvfile, fieldnames = fieldnames)
- writer.writeheader()
- for mapDocument in findFiles(r"W:/GIS (no purge)", '*.mxd'):
- print mapDocument
- st = os.stat(mapDocument)
- print "Using ArcPY Mods..."
- mxd = arcpy.mapping.MapDocument(mapDocument) #using arcpy to gather more information
- print "Reading Map Document..."
- writer.writerow({'File_Path' : str(mapDocument),
- 'File_Size(MB)' : str(((st[ST_SIZE])/1024.0)/1024.0),
- 'Last_Edit' : str(time.ctime(st[ST_MTIME])),
- 'MXD_Version' : getMXDVersion(mapDocument)})
- print "Searching Layers and Writing..."
- for layer in arcpy.mapping.ListLayers(mxd):
- print "boop"
- if layer.supports("DATASOURCE"):
- writer.writerow({'DATASOURCE' : layer.dataSource})
- else:
- break
- del mxd
- for lyr in lyrList:
- dType = "UNK"
- dName = "UNK"
- dPath = "UNK"
- if lyr.supports("dataSource"):
- if lyr.supports("workspacePath"):
- dPath = lyr.workspacePath
- if lyr.supports("datasetName"):
- dName = lyr.datasetName
- try:
- dType = arcpy.Describe(lyr.dataSource).datasettype
- except:
- dType = "Possible broken link"
- else:
- if lyr.isGroupLayer:
- dType = "Group Layer"
- if lyr.supports("SERVICEPROPERTIES"):
- arcpy.AddMessage('Found map survice')
- dType = lyr.serviceProperties["ServiceType"]
Add Comment
Please, Sign In to add comment