Created
October 7, 2014 20:51
-
-
Save TheNotary/a6d49660184690d38017 to your computer and use it in GitHub Desktop.
ij
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from arcpy import da | |
import os | |
inTable = arcpy.GetParameterAsText(0) | |
fileLocation = arcpy.GetParameterAsText(1) | |
with da.SearchCursor(inTable,['DATA','ATT_NAME']) as cursor: | |
for row in cursor: | |
binaryRep = row[0] | |
fileName = row[1] | |
# save to disk | |
open(fileLocation + os.sep + fileName, 'wb').write(binaryRep.tobytes()) | |
del row | |
del binaryRep | |
del fileName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ExportAttachments.py | |
#This script is for batch exporting attachments from ArcGIS Online. | |
#More info: http://www.cloudpointgeo.com/blog/blog/2014/3/5/getting-attachments-down-from-arcgis-online | |
from arcpy import da | |
import os | |
inTable = arcpy.GetParameterAsText(0) | |
fileLocation = arcpy.GetParameterAsText(1) | |
with with da.SearchCursor(inTable,['DATA','ATT_NAME','GlobalID']) as cursor: | |
for row in cursor: | |
binaryRep = row[0] | |
fileName = 'GlobalID_' + str(row[2]) + '-' + row[1] | |
# save to disk | |
open(fileLocation + os.sep + fileName, 'wb').write(binaryRep.tobytes()) | |
del row | |
del binaryRep | |
del fileName |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment