<?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 Re: How to download feature layer(s) to local machine using notebook in ArcGIS Notebooks Questions</title>
    <link>https://community.esri.com/t5/arcgis-notebooks-questions/how-to-download-feature-layer-s-to-local-machine/m-p/1147759#M482</link>
    <description>&lt;P&gt;Hey Josh,&lt;/P&gt;&lt;P&gt;I have been through the various posts above and a fairly deep dive into Esri documentation covering working with content in the workspace but failing epically to find why my script will not export results to the arcgis/home in Notebooks.&lt;/P&gt;&lt;P&gt;The script I am using(before I modified it to represent details above) works great from Pro to download all of the AGOL folder feature layer contents to a folder on my desktop, zipping each feature layer individually, and naming them by the y_m_d when the script was run. It works great but I have to set reminders to do this for my systems on a scheduled basis.&lt;/P&gt;&lt;P&gt;My goal it to use the Tasks tool in Notebooks to automate the process so I do not have to worry about it.&lt;/P&gt;&lt;P&gt;Any rate, the script runs in Notebooks, but never places anything in the home folder.&lt;/P&gt;&lt;P&gt;Here is the last part of the script;&lt;/P&gt;&lt;P&gt;And any guidance would be appreciated!!!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Folder layers export.jpg" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/34932i28989791D502B6F0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Folder layers export.jpg" alt="Folder layers export.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Feb 2022 22:12:34 GMT</pubDate>
    <dc:creator>RonaldVanderpool</dc:creator>
    <dc:date>2022-02-24T22:12:34Z</dc:date>
    <item>
      <title>How to download feature layer(s) to local machine using notebook</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/how-to-download-feature-layer-s-to-local-machine/m-p/247267#M50</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've been working through &lt;A href="https://support.esri.com/en/technical-article/000022524" rel="nofollow noopener noreferrer" target="_blank"&gt;this post&lt;/A&gt;&amp;nbsp;to try to download/backup my feature hosted layer(s) to gdb onto my local machine from ArcGIS Online using Notebook but it is not working. I can easily create a backup in&amp;nbsp;a&amp;nbsp;user's/my contents online but it does not work when I try and download the files to my desktop&amp;nbsp;or similar.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code is below (excluding personal info) - it doesn't error it just doesn't really do anything?! I'm very very new to this so appreciate its a bit clunky. Any tips greatly appreciated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;#import modules
from arcgis.gis import GIS
from arcgis.features import manage_data
import time, os, fnmatch, shutil
from pathlib import Path

gis = GIS(username="Username", password="Password")

item_id = 'itemid'

data_item = gis.content.get(item_id)
data_item
data_item.title

fgdb_title = data_item.title
t = time.localtime()
timestamp = time.strftime('%d%b%Y_%H%M',t)
result = data_item.export(fgdb_title + ' ' + timestamp, "File Geodatabase")
result

data_path = Path(r'C:\Users\name\Desktop\backup')
if not data_path.exists():
 data_path.mkdir()
extract_path = data_path.joinpath('export')
result.download(save_path=data_path)
result.download&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:14:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/how-to-download-feature-layer-s-to-local-machine/m-p/247267#M50</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T16:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to download feature layer(s) to local machine using notebook</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/how-to-download-feature-layer-s-to-local-machine/m-p/247268#M51</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Flora,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm so sorry for the slow response - your question must have slipped through the cracks. In case you still have this question I'll answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your code is good, it's only the filepath that needs changing. Due to the&amp;nbsp;nature of ArcGIS Online Notebooks, you cannot use your local filepath to download &lt;EM&gt;directly&lt;/EM&gt; to your desktop. You will instead need to download your export result&amp;nbsp;to your AGOL Notebook working directory ('/arcgis/home/' accessible via the&amp;nbsp;&lt;EM&gt;files&lt;/EM&gt; tab in the Notebook UI) and can then download the resulting .zip file to your desktop by clicking it in the UI. If you wish to&amp;nbsp;download several feature services you should download them all to the same folder, and then zip that folder using ZipFile. This will save you from having to manually click on&amp;nbsp;each FGDB you export.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is an example of what&amp;nbsp;can be done.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/499633_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have anymore questions please&amp;nbsp;feel free to ask.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Josh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2020 22:28:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/how-to-download-feature-layer-s-to-local-machine/m-p/247268#M51</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-07-08T22:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to download feature layer(s) to local machine using notebook</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/how-to-download-feature-layer-s-to-local-machine/m-p/247269#M52</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Josh,&lt;/P&gt;&lt;P&gt;Thanks for this! And no worries about the slow reply - I've only just revisited this. I've developed the code a little more so it reads through my content and exports certain item types. It works for the most part but there are a few that fail with the error &lt;STRONG&gt;exportItemId&lt;/STRONG&gt;. Do you know what this means and what I need to do to my code to troubleshoot this? I've attached the last cell in my code below and an example of one of the failed error messages.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for data_item in useful:
 &amp;nbsp;&amp;nbsp;&amp;nbsp;print("\nProcessing: " + data_item.title)
 &amp;nbsp;&amp;nbsp;&amp;nbsp;try:
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;result = data_item.export(data_item.title, "File Geodatabase")
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;result.download(path)
 &amp;nbsp;&amp;nbsp;&amp;nbsp;except Exception as e:
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print ("Error occurred \n",e)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Processing: Local Routes Error occurred   'exportItemId'&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:14:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/how-to-download-feature-layer-s-to-local-machine/m-p/247269#M52</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T16:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to download feature layer(s) to local machine using notebook</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/how-to-download-feature-layer-s-to-local-machine/m-p/247270#M53</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Flora - glad to hear you weren't waiting around! At first glance your code seems fine, it's hard to say what exactly is wrong without knowing what your variables contain. Is `useful` an array of items found via the search function?&amp;nbsp; What's `path` set to?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also if you break it out into separate cells it'll help us debug&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/504131_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Aug 2020 17:59:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/how-to-download-feature-layer-s-to-local-machine/m-p/247270#M53</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-08-20T17:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to download feature layer(s) to local machine using notebook</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/how-to-download-feature-layer-s-to-local-machine/m-p/247271#M54</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A little off topic, but I have created some files in the&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;/arcgis/home area but I don’t seem to be able to delete things,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;any guidance?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Ian&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 06 Sep 2020 11:02:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/how-to-download-feature-layer-s-to-local-machine/m-p/247271#M54</guid>
      <dc:creator>IanHamilton1</dc:creator>
      <dc:date>2020-09-06T11:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to download feature layer(s) to local machine using notebook</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/how-to-download-feature-layer-s-to-local-machine/m-p/247272#M55</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ian - Are you trying to delete individual&amp;nbsp;files, or folders? We currently don't support recursive delete in the UI so any deletes to folders containing files will not work. However, notebooks do support UNIX commands. If you wish to delete a directory and its contents you can run the rm command inside a cell with the recursive flag (-r).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;!rm -r /arcgis/home/testFolder&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If instead you are experiencing issues deleting individual files via the UI, please let me know or contact support.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Josh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Sep 2020 16:57:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/how-to-download-feature-layer-s-to-local-machine/m-p/247272#M55</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-09-22T16:57:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to download feature layer(s) to local machine using notebook</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/how-to-download-feature-layer-s-to-local-machine/m-p/1022081#M243</link>
      <description>&lt;P&gt;Josh,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Is there any way to download files from my online Notbook files area to the browser using code rather than the UI?&amp;nbsp; It would be far preferable to execute a cell that downloads the results of my geoprocessing rather than try to give an end user instructions for how to click on the "Files" button, and look for a file of a particular name, and so on.&lt;/P&gt;&lt;P&gt;&amp;nbsp; Any help would be appreciated.&lt;/P&gt;&lt;P&gt;Clay&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2021 13:59:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/how-to-download-feature-layer-s-to-local-machine/m-p/1022081#M243</guid>
      <dc:creator>DareWater</dc:creator>
      <dc:date>2021-02-01T13:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to download feature layer(s) to local machine using notebook</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/how-to-download-feature-layer-s-to-local-machine/m-p/1113199#M433</link>
      <description>&lt;P&gt;I second this, We would love a way to have our backups on our local drive rather than have them stored in this folder.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Nov 2021 14:31:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/how-to-download-feature-layer-s-to-local-machine/m-p/1113199#M433</guid>
      <dc:creator>gis_user_ca</dc:creator>
      <dc:date>2021-11-02T14:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to download feature layer(s) to local machine using notebook</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/how-to-download-feature-layer-s-to-local-machine/m-p/1147759#M482</link>
      <description>&lt;P&gt;Hey Josh,&lt;/P&gt;&lt;P&gt;I have been through the various posts above and a fairly deep dive into Esri documentation covering working with content in the workspace but failing epically to find why my script will not export results to the arcgis/home in Notebooks.&lt;/P&gt;&lt;P&gt;The script I am using(before I modified it to represent details above) works great from Pro to download all of the AGOL folder feature layer contents to a folder on my desktop, zipping each feature layer individually, and naming them by the y_m_d when the script was run. It works great but I have to set reminders to do this for my systems on a scheduled basis.&lt;/P&gt;&lt;P&gt;My goal it to use the Tasks tool in Notebooks to automate the process so I do not have to worry about it.&lt;/P&gt;&lt;P&gt;Any rate, the script runs in Notebooks, but never places anything in the home folder.&lt;/P&gt;&lt;P&gt;Here is the last part of the script;&lt;/P&gt;&lt;P&gt;And any guidance would be appreciated!!!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Folder layers export.jpg" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/34932i28989791D502B6F0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Folder layers export.jpg" alt="Folder layers export.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Feb 2022 22:12:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/how-to-download-feature-layer-s-to-local-machine/m-p/1147759#M482</guid>
      <dc:creator>RonaldVanderpool</dc:creator>
      <dc:date>2022-02-24T22:12:34Z</dc:date>
    </item>
  </channel>
</rss>

