Esox

Save lyr-files from multiple files of the table of contents

Discussion created by Esox on Nov 29, 2012
Latest reply on Nov 29, 2012 by jskinner-esristaff
Hallo,

I would like to save lyr-files from multiple Features in the table of contents.

This works:

[PHP]import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
for lyr in arcpy.mapping.ListLayers(mxd):
    lyr.saveACopy(lyr.name + ".lyr")
[/PHP]

It includes files in groups but unfortunately also the group names themselves.
Is it possible to avoid that lyrs are made from the groupname, but only from the content of the group?

Further, it is possible to exclude certain layers / layergroups?

Would be very kind if you could help me out with some code-snippets?

Yours,

Matthias

Outcomes