<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How can I modify zip output from arcpy.ExtractData_server sample in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-can-i-modify-zip-output-from-arcpy-extractdata/m-p/362912#M28688</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Q: Is there a &lt;EM&gt;simple&lt;/EM&gt; python way to reoganize a zip?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;In an attempt to simplify the conversion from our regular updates from a feature class in a FGDB to zipped shapefile for uploading into &lt;A href="https://community.esri.com/space/2106" target="_blank"&gt;ArcGIS Online&lt;/A&gt; for users to download, I'm modifying the model&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="209631" alt="" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/209631_pastedImage_10.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;(converted to &lt;A href="https://community.esri.com/group/1519" target="_blank"&gt;python snippets&lt;/A&gt;​ ).&amp;nbsp; This sample, per the help &lt;A href="http://desktop.arcgis.com/en/arcmap/10.3/tools/server-toolbox/extract-data.htm" title="http://desktop.arcgis.com/en/arcmap/10.3/tools/server-toolbox/extract-data.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Extract Data—Help | ArcGIS for Desktop&lt;/A&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; Extracts selected layers in the specified area of interest to a specific format and spatial reference. The extracted data is then written to a zip file.&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;H5 class="icon-caution-cone" id="toc-hId-1089279176"&gt;Caution:&lt;/H5&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;This tool is intended primarily for use as part of a geoprocessing service. When using this tool as part of a geoprocessing service, copy the tool into a custom toolbox, edit the model, and reconfigure it as necessary. For step-by-step instructions on how to make, use, and configure a geoprocessing service using this tool, see &lt;A class="xref" href="http://desktop.arcgis.com/en/arcmap/10.3/analyze/sharing-workflows/gp-service-example-clip-and-ship.htm#ESRI_SECTION1_1899B0F6840A4810A0CBC64286173E06" rel="nofollow noopener noreferrer" target="_blank"&gt;Geoprocessing service example: Clip And Ship&lt;/A&gt;.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Although it is meant to be used as a GP tool, I have been able to get my script to work, but the output it not AGOL friendly.&amp;nbsp; That is, it adds another layer/folder in the zip structure...&amp;nbsp; e.g.&amp;nbsp; myfile.zip\zipfolder#\myshapefile.*&amp;nbsp;&amp;nbsp; This "zipfolder#" seems to be hard coded into the ExtractData_server.&amp;nbsp; I know there are other scripts to open/read/write to a .zip, but this actually works nice, except for that added folder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a &lt;STRONG&gt;simple&lt;/STRONG&gt; python way to reoganize a zip.&amp;nbsp; If it requires an open-cursor-write-close like the samples I've seen, I may just go that route and skip the ExtractData command, but other than that extra layer, this custom version works great for my needs&amp;nbsp; (just one shapefile to a zip)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've testing in 10.2.2 and 10.3.1, Catalog and map (python command window, not as a tool yet)&lt;/P&gt;&lt;P&gt;outputted format:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;IMG __jive_id="209630" alt="" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/209630_pastedImage_7.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;would like the "zipfolder#" level removed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my test script:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import arcpy module
import arcpy
import os
import time
from time import localtime

def myMsgs(message):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("{0}".format(message))
&amp;nbsp;&amp;nbsp;&amp;nbsp; print("{0}".format(message)&amp;nbsp; )

# Script arguments...
sourceGDB = arcpy.GetParameterAsText(0)
if not sourceGDB:
&amp;nbsp;&amp;nbsp;&amp;nbsp; sourceGDB = r"d:\data\wc\Master_update.gdb"

sourceFDS = arcpy.GetParameterAsText(1)
if not sourceFDS:
&amp;nbsp;&amp;nbsp;&amp;nbsp; sourceFDS = "DWCMasters"&amp;nbsp;&amp;nbsp; 
myMsgs(sourceFDS)
sourceFDS = os.path.join(sourceGDB, sourceFDS)
myMsgs(sourceFDS)

GMULayers = arcpy.GetParameterAsText(2)
if not GMULayers:
&amp;nbsp;&amp;nbsp;&amp;nbsp; GMULayers = os.path.join(sourceGDB, "GMULayers")
myMsgs(GMULayers)

# export as shape files...will create folder for pubYear&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
targetFolder = arcpy.GetParameterAsText(3)&amp;nbsp;&amp;nbsp; 
if not targetFolder:
&amp;nbsp;&amp;nbsp;&amp;nbsp; targetFolder = r"d:\_forAGOLdist"
pubYear = localtime().tm_year
targetFolder = os.path.join(targetFolder, ("{0}_test".format(pubYear)))
if not os.path.isdir(targetFolder):
&amp;nbsp;&amp;nbsp;&amp;nbsp; os.mkdir(targetFolder)
&amp;nbsp;&amp;nbsp;&amp;nbsp; myMsgs("Creating target folder: {0}".format(targetFolder))
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; myMsgs("Output shapes will be written to: {0}".format(targetFolder))

Feature_Format = "Shapefile - SHP - .shp"
Raster_Format = '#'
Spatial_Reference = "Same As Input"
Custom_Spatial_Reference_Folder = ""

# subs
inSubsFC = os.path.join(GMULayers, "Subunits")&amp;nbsp;&amp;nbsp; 
inSubFL = "Subunits_Layer"
Layers_to_Clip = inSubFL
Area_of_Interest = Layers_to_Clip
Output_Zip_File = os.path.join(targetFolder, "Subunits.zip")
arcpy.MakeFeatureLayer_management(inSubsFC,inSubFL)
arcpy.ExtractData_server(Layers_to_Clip, Area_of_Interest, Feature_Format, Raster_Format, Spatial_Reference, Custom_Spatial_Reference_Folder, Output_Zip_File)

# Spec Areas
inSAFC = os.path.join(sourceFDS, "SpecialAreas")
inSAFL = "SpecArea_Layer"
qryActive = "status = 'a'"
Layers_to_Clip = inSAFL
Area_of_Interest = Layers_to_Clip
Output_Zip_File = os.path.join(targetFolder, "SpecAreas.zip")
field_info = ("OBJECTID OBJECTID VISIBLE NONE;Shape Shape VISIBLE NONE;TYPE TYPE VISIBLE NONE;AREANAME AREANAME VISIBLE NONE;SHORTNAME SHORTNAME VISIBLE NONE;GMU GMU VISIBLE NONE;REGION REGION VISIBLE NONE;gisNotes gisNotes HIDDEN NONE;created_user created_user HIDDEN NONE;created_date created_date HIDDEN NONE;last_edited_user last_edited_user HIDDEN NONE;last_edited_date last_edited_date HIDDEN NONE;status status HIDDEN NONE;Shape_Length Shape_Length HIDDEN NONE;Shape_Area Shape_Area HIDDEN NONE;SqMi SqMi VISIBLE NONE")

arcpy.MakeFeatureLayer_management(inSAFC, inSAFL,qryActive,"#",field_info)
arcpy.ExtractData_server(Layers_to_Clip, Area_of_Interest, Feature_Format, Raster_Format, Spatial_Reference, Custom_Spatial_Reference_Folder, Output_Zip_File)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've found a couple py-zip type samples in my searches, but again, they all require the O-R-Wr-Cl operation, which will be ok, but then I would skip the command, since this is a simple shapefile to .zip I'm trying to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit: added line 58, so output changed&lt;/P&gt;&lt;P&gt;more edits....lots of typos...must be getting tired.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 16:55:21 GMT</pubDate>
    <dc:creator>RebeccaStrauch__GISP</dc:creator>
    <dc:date>2021-12-11T16:55:21Z</dc:date>
    <item>
      <title>How can I modify zip output from arcpy.ExtractData_server sample</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-modify-zip-output-from-arcpy-extractdata/m-p/362912#M28688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Q: Is there a &lt;EM&gt;simple&lt;/EM&gt; python way to reoganize a zip?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;In an attempt to simplify the conversion from our regular updates from a feature class in a FGDB to zipped shapefile for uploading into &lt;A href="https://community.esri.com/space/2106" target="_blank"&gt;ArcGIS Online&lt;/A&gt; for users to download, I'm modifying the model&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="209631" alt="" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/209631_pastedImage_10.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;(converted to &lt;A href="https://community.esri.com/group/1519" target="_blank"&gt;python snippets&lt;/A&gt;​ ).&amp;nbsp; This sample, per the help &lt;A href="http://desktop.arcgis.com/en/arcmap/10.3/tools/server-toolbox/extract-data.htm" title="http://desktop.arcgis.com/en/arcmap/10.3/tools/server-toolbox/extract-data.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Extract Data—Help | ArcGIS for Desktop&lt;/A&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; Extracts selected layers in the specified area of interest to a specific format and spatial reference. The extracted data is then written to a zip file.&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;H5 class="icon-caution-cone" id="toc-hId-1089279176"&gt;Caution:&lt;/H5&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;This tool is intended primarily for use as part of a geoprocessing service. When using this tool as part of a geoprocessing service, copy the tool into a custom toolbox, edit the model, and reconfigure it as necessary. For step-by-step instructions on how to make, use, and configure a geoprocessing service using this tool, see &lt;A class="xref" href="http://desktop.arcgis.com/en/arcmap/10.3/analyze/sharing-workflows/gp-service-example-clip-and-ship.htm#ESRI_SECTION1_1899B0F6840A4810A0CBC64286173E06" rel="nofollow noopener noreferrer" target="_blank"&gt;Geoprocessing service example: Clip And Ship&lt;/A&gt;.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Although it is meant to be used as a GP tool, I have been able to get my script to work, but the output it not AGOL friendly.&amp;nbsp; That is, it adds another layer/folder in the zip structure...&amp;nbsp; e.g.&amp;nbsp; myfile.zip\zipfolder#\myshapefile.*&amp;nbsp;&amp;nbsp; This "zipfolder#" seems to be hard coded into the ExtractData_server.&amp;nbsp; I know there are other scripts to open/read/write to a .zip, but this actually works nice, except for that added folder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a &lt;STRONG&gt;simple&lt;/STRONG&gt; python way to reoganize a zip.&amp;nbsp; If it requires an open-cursor-write-close like the samples I've seen, I may just go that route and skip the ExtractData command, but other than that extra layer, this custom version works great for my needs&amp;nbsp; (just one shapefile to a zip)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've testing in 10.2.2 and 10.3.1, Catalog and map (python command window, not as a tool yet)&lt;/P&gt;&lt;P&gt;outputted format:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;IMG __jive_id="209630" alt="" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/209630_pastedImage_7.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;would like the "zipfolder#" level removed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my test script:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import arcpy module
import arcpy
import os
import time
from time import localtime

def myMsgs(message):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("{0}".format(message))
&amp;nbsp;&amp;nbsp;&amp;nbsp; print("{0}".format(message)&amp;nbsp; )

# Script arguments...
sourceGDB = arcpy.GetParameterAsText(0)
if not sourceGDB:
&amp;nbsp;&amp;nbsp;&amp;nbsp; sourceGDB = r"d:\data\wc\Master_update.gdb"

sourceFDS = arcpy.GetParameterAsText(1)
if not sourceFDS:
&amp;nbsp;&amp;nbsp;&amp;nbsp; sourceFDS = "DWCMasters"&amp;nbsp;&amp;nbsp; 
myMsgs(sourceFDS)
sourceFDS = os.path.join(sourceGDB, sourceFDS)
myMsgs(sourceFDS)

GMULayers = arcpy.GetParameterAsText(2)
if not GMULayers:
&amp;nbsp;&amp;nbsp;&amp;nbsp; GMULayers = os.path.join(sourceGDB, "GMULayers")
myMsgs(GMULayers)

# export as shape files...will create folder for pubYear&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
targetFolder = arcpy.GetParameterAsText(3)&amp;nbsp;&amp;nbsp; 
if not targetFolder:
&amp;nbsp;&amp;nbsp;&amp;nbsp; targetFolder = r"d:\_forAGOLdist"
pubYear = localtime().tm_year
targetFolder = os.path.join(targetFolder, ("{0}_test".format(pubYear)))
if not os.path.isdir(targetFolder):
&amp;nbsp;&amp;nbsp;&amp;nbsp; os.mkdir(targetFolder)
&amp;nbsp;&amp;nbsp;&amp;nbsp; myMsgs("Creating target folder: {0}".format(targetFolder))
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; myMsgs("Output shapes will be written to: {0}".format(targetFolder))

Feature_Format = "Shapefile - SHP - .shp"
Raster_Format = '#'
Spatial_Reference = "Same As Input"
Custom_Spatial_Reference_Folder = ""

# subs
inSubsFC = os.path.join(GMULayers, "Subunits")&amp;nbsp;&amp;nbsp; 
inSubFL = "Subunits_Layer"
Layers_to_Clip = inSubFL
Area_of_Interest = Layers_to_Clip
Output_Zip_File = os.path.join(targetFolder, "Subunits.zip")
arcpy.MakeFeatureLayer_management(inSubsFC,inSubFL)
arcpy.ExtractData_server(Layers_to_Clip, Area_of_Interest, Feature_Format, Raster_Format, Spatial_Reference, Custom_Spatial_Reference_Folder, Output_Zip_File)

# Spec Areas
inSAFC = os.path.join(sourceFDS, "SpecialAreas")
inSAFL = "SpecArea_Layer"
qryActive = "status = 'a'"
Layers_to_Clip = inSAFL
Area_of_Interest = Layers_to_Clip
Output_Zip_File = os.path.join(targetFolder, "SpecAreas.zip")
field_info = ("OBJECTID OBJECTID VISIBLE NONE;Shape Shape VISIBLE NONE;TYPE TYPE VISIBLE NONE;AREANAME AREANAME VISIBLE NONE;SHORTNAME SHORTNAME VISIBLE NONE;GMU GMU VISIBLE NONE;REGION REGION VISIBLE NONE;gisNotes gisNotes HIDDEN NONE;created_user created_user HIDDEN NONE;created_date created_date HIDDEN NONE;last_edited_user last_edited_user HIDDEN NONE;last_edited_date last_edited_date HIDDEN NONE;status status HIDDEN NONE;Shape_Length Shape_Length HIDDEN NONE;Shape_Area Shape_Area HIDDEN NONE;SqMi SqMi VISIBLE NONE")

arcpy.MakeFeatureLayer_management(inSAFC, inSAFL,qryActive,"#",field_info)
arcpy.ExtractData_server(Layers_to_Clip, Area_of_Interest, Feature_Format, Raster_Format, Spatial_Reference, Custom_Spatial_Reference_Folder, Output_Zip_File)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've found a couple py-zip type samples in my searches, but again, they all require the O-R-Wr-Cl operation, which will be ok, but then I would skip the command, since this is a simple shapefile to .zip I'm trying to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit: added line 58, so output changed&lt;/P&gt;&lt;P&gt;more edits....lots of typos...must be getting tired.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:55:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-modify-zip-output-from-arcpy-extractdata/m-p/362912#M28688</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2021-12-11T16:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify zip output from arcpy.ExtractData_server sample</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-modify-zip-output-from-arcpy-extractdata/m-p/362913#M28689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So this &lt;A href="https://docs.python.org/2/library/zipfile.html" title="https://docs.python.org/2/library/zipfile.html"&gt;12.4. zipfile — Work with ZIP archives — Python 2.7.12 documentation&lt;/A&gt;&amp;nbsp; is no good? haven't looked at it too deeply though&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2016 01:46:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-modify-zip-output-from-arcpy-extractdata/m-p/362913#M28689</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-06-28T01:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify zip output from arcpy.ExtractData_server sample</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-modify-zip-output-from-arcpy-extractdata/m-p/362914#M28690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I looked at that, but it gets into the open-loop-write-close process.&amp;nbsp; I liked the simplicity of the Extract tool understanding shapefiles off the bat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found &lt;A href="http://geospatialpython.com/2010/11/introducing-python-shapefile-library.html" title="http://geospatialpython.com/2010/11/introducing-python-shapefile-library.html"&gt;GeospatialPython.com: Introducing the Python Shapefile Library&lt;/A&gt;&amp;nbsp;&amp;nbsp; or a link to the same library on another page, but was a bit confused by what I got on the other page...but plan to look more at this in the am.&amp;nbsp; Some of the links on that page are broken (2010) but this works &lt;A href="https://pythonhosted.org/Python%20Shapefile%20Library/" title="https://pythonhosted.org/Python%20Shapefile%20Library/"&gt;https://pythonhosted.org/Python%20Shapefile%20Library/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...actually this github version looks more promising (updated more recently) &lt;A href="https://github.com/GeospatialPython/pyshp" title="https://github.com/GeospatialPython/pyshp"&gt;GitHub - GeospatialPython/pyshp: This library reads and writes ESRI Shapefiles in pure Python.&lt;/A&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I don't think it does .zip files direct, but does understand r/w or shapefiles somewhat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again, the extract worked great, and I know the extra folder structure is there for a reason, just not what I need or can use for my AGOL updates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For my immediate needs, I just did it manually, but would be nice to have it as part of my addin.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit: btw Dan, thanks for the response.&amp;nbsp; Never hurts to ask me if I've seen it since sometimes it is easy to miss something.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2016 02:02:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-modify-zip-output-from-arcpy-extractdata/m-p/362914#M28690</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2016-06-28T02:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify zip output from arcpy.ExtractData_server sample</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-modify-zip-output-from-arcpy-extractdata/m-p/362915#M28691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rebecca, I haven't got time to check and I am working on the iThing, but there are some examples of zipfile and shutil to create zips... but again, I don't know if they do the inside folder thing.&lt;/P&gt;&lt;P&gt;&lt;A href="http://stackoverflow.com/questions/1855095/how-to-create-a-zip-archive-of-a-directory" title="http://stackoverflow.com/questions/1855095/how-to-create-a-zip-archive-of-a-directory"&gt;python - How to create a zip archive of a directory - Stack Overflow&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;A href="http://stackoverflow.com/questions/14568647/create-zip-in-python" title="http://stackoverflow.com/questions/14568647/create-zip-in-python"&gt;Create .zip in Python? - Stack Overflow&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;A href="http://effbot.org/librarybook/zipfile.htm" title="http://effbot.org/librarybook/zipfile.htm"&gt;The zipfile module&lt;/A&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; amongst others &lt;/P&gt;&lt;P&gt;good luck&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2016 02:39:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-modify-zip-output-from-arcpy-extractdata/m-p/362915#M28691</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-06-28T02:39:52Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify zip output from arcpy.ExtractData_server sample</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-modify-zip-output-from-arcpy-extractdata/m-p/362916#M28692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The zipfile module works well.&amp;nbsp; You can zip the files in a folder like so:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import zipfile
outputSHPzip = arcpy.env.scratchFolder + "\\shpzip.zip"
shpZip = zipfile.ZipFile(outputSHPzip, "w")
for root, dirs, files in os.walk(ShapefileFolder):
&amp;nbsp;&amp;nbsp; for f in files:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shpZip.write(os.path.join(root, f), f)
shpZip.close()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:55:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-modify-zip-output-from-arcpy-extractdata/m-p/362916#M28692</guid>
      <dc:creator>FC_Basson</dc:creator>
      <dc:date>2021-12-11T16:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify zip output from arcpy.ExtractData_server sample</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-modify-zip-output-from-arcpy-extractdata/m-p/362917#M28693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm giving&amp;nbsp; FC Basson the credit for the right answer, even thought that wasn't the answer I was hoping for, so I can close this out for now.&amp;nbsp; It's simialr to all the links I had found and Dan had pointed to.&amp;nbsp; I'll keep working on it, but will be off this project for a few weeks.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the long run, I would have liked a way to override the folder creation in the ExtractData tool, and may&amp;nbsp; inquire about options when at the UC (although my guess is I will be pointed to same answer).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2016 21:44:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-modify-zip-output-from-arcpy-extractdata/m-p/362917#M28693</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2016-06-28T21:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify zip output from arcpy.ExtractData_server sample</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-modify-zip-output-from-arcpy-extractdata/m-p/362918#M28694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a opposite way? I am trying to write a python script about&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;zip file (“TEST.gbd.zip”) containing a File Geodatabase with both feature classes from FTP County and I need it to download.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Aug 2017 12:24:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-modify-zip-output-from-arcpy-extractdata/m-p/362918#M28694</guid>
      <dc:creator>AlexP_</dc:creator>
      <dc:date>2017-08-25T12:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify zip output from arcpy.ExtractData_server sample</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-modify-zip-output-from-arcpy-extractdata/m-p/362919#M28695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Is there a opposite way? I am trying to write a python script about&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;zip file&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I'm not exactly sure what you are asking, but if you haven't already you may want to ask this as a new question.&amp;nbsp; &lt;/P&gt;&lt;P&gt;See &lt;A href="https://community.esri.com/community/help-and-feedback/blog/2016/08/15/community-news-and-tips-how-to-ask-questions-and-get-answers?sr=search&amp;amp;searchId=c97f3da8-ebe1-41cd-9fce-970939e028f9&amp;amp;searchIndex=0"&gt;https://community.esri.com/community/help-and-feedback/blog/2016/08/15/community-news-and-tips-how-to-ask-questions-and-get-answers?sr=search&amp;amp;searchId=c97f3da8-ebe1-41cd-9fce-970939e028f9&amp;amp;searchIndex=0&lt;/A&gt;‌ if you haven't posted a question before, and if you have code to post, take a look at &lt;A href="https://community.esri.com/people/curtvprice/blog/2014/09/25/posting-code-blocks-in-the-new-geonet?sr=search&amp;amp;searchId=c7660506-40c1-4a6d-96f3-9bb8f1c54281&amp;amp;searchIndex=2"&gt;https://community.esri.com/people/curtvprice/blog/2014/09/25/posting-code-blocks-in-the-new-geonet?sr=search&amp;amp;searchId=c7660506-40c1-4a6d-96f3-9bb8f1c54281&amp;amp;searchIndex=2&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Aug 2017 23:22:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-modify-zip-output-from-arcpy-extractdata/m-p/362919#M28695</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2017-08-28T23:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify zip output from arcpy.ExtractData_server sample</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-modify-zip-output-from-arcpy-extractdata/m-p/362920#M28696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rebecca,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your reply. I posted it last week but no one has answer yet. I can't post full script because it is not public. Is there a way to show private to someone and someone might know what I am talking about?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I posted this question on geonet:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;There is a zip file (“TEST.gbd.zip”) containing a File Geodatabase with both feature classes from FTP County and I need it to download. What is the python script for this case? Please advise. Thank you.&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;For example, I pulled this part of script like this: &amp;nbsp;but what about zip file? It has compressed zip file.&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="" style="color: slategray; border: 0px; font-weight: inherit; font-size: 14px;"&gt;# List of Other files to download&lt;/SPAN&gt;
&lt;SPAN class="" style="color: slategray; border: 0px; font-weight: inherit; font-size: 14px;"&gt;# Syntax: County file name with extension separated by colon, then&lt;/SPAN&gt;
&lt;SPAN class="" style="color: slategray; border: 0px; font-weight: inherit; font-size: 14px;"&gt;# the FTP Folder name&lt;/SPAN&gt;
CountyOtherFiles &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit; font-size: 14px;"&gt;=&lt;/SPAN&gt; &lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;{&lt;/SPAN&gt;
 &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit; font-size: 14px;"&gt;'pa_parceldata.dat'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;:&lt;/SPAN&gt;r&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit; font-size: 14px;"&gt;'GISdata/Pa_data/'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;,&lt;/SPAN&gt;
 &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit; font-size: 14px;"&gt;'pa_parceldata.txt'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;:&lt;/SPAN&gt;r&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit; font-size: 14px;"&gt;'GISdata/Pa_data/'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;,&lt;/SPAN&gt;
 &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit; font-size: 14px;"&gt;'pa_legal_ln.dat'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;:&lt;/SPAN&gt;r&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit; font-size: 14px;"&gt;'GISdata/Pa_data/'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;,&lt;/SPAN&gt;
 &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit; font-size: 14px;"&gt;'pa_legal_ln.txt'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;:&lt;/SPAN&gt;r&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit; font-size: 14px;"&gt;'GISdata/Pa_data/'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;,&lt;/SPAN&gt;
&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="border-width: 0px 1px 0px 0px; border-style: initial solid initial initial; border-color: initial #999999 initial initial; font-weight: inherit;"&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P style="color: #242729; border: 0px; font-size: 15px; margin: 0px 0px 1em;"&gt;I am new to python script. I have been researched thru here and having difficult to find a right answer. I have compressed zipfile in FTP WinSCP.&lt;/P&gt;&lt;P style="color: #242729; border: 0px; font-size: 15px; margin: 0px 0px 1em;"&gt;I am trying to extract or unzip in python from FTP Winscp? It has compressed zip file in FTP. I have Winscp connect to FTP. I am not sure what is the right script for this case. I already have script set up that has been created by someone else. Please advise. Thank you.&lt;/P&gt;&lt;P style="color: #242729; border: 0px; font-size: 15px; margin: 0px 0px 1em;"&gt;I tried to use this script but I got an error.&amp;nbsp;&lt;/P&gt;&lt;P style="color: #242729; border: 0px; font-size: 15px; margin: 0px 0px 1em;"&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt;ZipFile&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt;extractall&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt;path&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt;'GISData/Pubshp'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt; members&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt;'PaFiles.gdb.zip'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt;NameError&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt;:&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt; name &lt;/SPAN&gt;&lt;SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt;'ZipFile'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #101094; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt;is&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #101094; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt;not&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit; margin: 0px;"&gt; defined&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:55:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-modify-zip-output-from-arcpy-extractdata/m-p/362920#M28696</guid>
      <dc:creator>AlexP_</dc:creator>
      <dc:date>2021-12-11T16:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify zip output from arcpy.ExtractData_server sample</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-modify-zip-output-from-arcpy-extractdata/m-p/362921#M28697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found where you posted it, and it's good that you tagged a couple other spaces.&amp;nbsp; If no one else takes a look or answers it, I can take a look at it in a few hours (during lunch).&amp;nbsp; I followed you, so if you follow me you can send the .zip in a direct message (DM) thru geonet.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2017 16:31:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-modify-zip-output-from-arcpy-extractdata/m-p/362921#M28697</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2017-08-29T16:31:43Z</dc:date>
    </item>
  </channel>
</rss>

