<?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: Copy files from /tmp to abfss location in Administration &amp; Architecture</title>
    <link>https://community.databricks.com/t5/administration-architecture/copy-files-from-tmp-to-abfss-location/m-p/150670#M5009</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/56679"&gt;@deepu&lt;/a&gt;,&lt;/P&gt;
&lt;P class="p8i6j01 paragraph"&gt;The reason it isn't working is that Python’s shutil only understands local/POSIX-style paths, not abfss:// URIs, and dbutils.fs expects Databricks-style paths (e.g., file:/..., /Volumes/...).&amp;nbsp;&lt;/P&gt;
&lt;P class="p8i6j01 paragraph"&gt;The recommended pattern for this is..&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Write reports to local disk (what you already do, /tmp).&lt;/LI&gt;
&lt;LI&gt;Copy from local disk --&amp;gt; a Unity Catalog volume (backed by your external location).&lt;/LI&gt;
&lt;LI&gt;Always reference the volume via /Volumes/... paths inside Databricks, not raw abfss:// from Python stdlib.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;On Unity Catalog enabled clusters, you’re dealing with two different file systems:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;/tmp is ephemeral local storage on the driver.&lt;/LI&gt;
&lt;LI&gt;abfss://... is remote cloud storage.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Firstly, back your external location with a UC volume if you haven't done that already. For example,&amp;nbsp;&lt;/P&gt;
&lt;DIV class="l8rrz21 _1ibi0s3dn" data-ui-element="code-block-container"&gt;
&lt;PRE&gt;&lt;CODE class="markdown-code-sql p8i6j0e hljs language-sql _12n1b832"&gt;&lt;SPAN class="hljs-keyword"&gt;CREATE&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;EXTERNAL&lt;/SPAN&gt; VOLUME main.reporting.reports_archive
  LOCATION &lt;SPAN class="hljs-string"&gt;'abfss://&amp;lt;container&amp;gt;@&amp;lt;account&amp;gt;.dfs.core.windows.net/&amp;lt;path&amp;gt;'&lt;/SPAN&gt;;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;P&gt;Make sure the user/service has USE CATALOG, USE SCHEMA and WRITE VOLUME on this volume.&lt;/P&gt;
&lt;DIV class="tk0j8o1 _1ibi0s31a _1ibi0s3dn"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="tk0j8o1 _1ibi0s31a _1ibi0s3dn"&gt;You can then copy from /tmp to the volume you created (as above)&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="l8rrz21 _1ibi0s3dn" data-ui-element="code-block-container"&gt;
&lt;PRE&gt;&lt;CODE class="markdown-code-python p8i6j0e hljs language-python _12n1b832"&gt;dbutils.fs.cp(
    &lt;SPAN class="hljs-string"&gt;"file:/tmp/my_report.xlsx"&lt;/SPAN&gt;,
    &lt;SPAN class="hljs-string"&gt;"/Volumes/main/reporting/reports_archive/my_report.xlsx"&lt;/SPAN&gt;,
    &lt;SPAN class="hljs-literal"&gt;True&lt;/SPAN&gt;  &lt;SPAN class="hljs-comment"&gt;# overwrite&lt;/SPAN&gt;
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="l8rrz23 _1ibi0s3d6 _1ibi0s332 _1ibi0s3do _1ibi0s3bm _1ibi0s3ce"&gt;
&lt;DIV class="lqznwq0"&gt;&lt;SPAN&gt;The &lt;/SPAN&gt;&lt;SPAN&gt;file:/&lt;/SPAN&gt;&lt;SPAN&gt; prefix is required for &lt;/SPAN&gt;&lt;SPAN&gt;dbutils.fs&lt;/SPAN&gt;&lt;SPAN&gt; to see local/ephemeral storage, and &lt;/SPAN&gt;&lt;SPAN&gt;/Volumes/...&lt;/SPAN&gt;&lt;SPAN&gt; is the POSIX-style path for your UC volume.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="tk0j8o1 _1ibi0s31a _1ibi0s3dn"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Alternatively, you can&amp;nbsp;use shutil against the volume path (not abfss):&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="l8rrz21 _1ibi0s3dn" data-ui-element="code-block-container"&gt;
&lt;PRE&gt;&lt;CODE class="markdown-code-python p8i6j0e hljs language-python _12n1b832"&gt;&lt;SPAN class="hljs-keyword"&gt;from&lt;/SPAN&gt; shutil &lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; copyfile

copyfile(
    &lt;SPAN class="hljs-string"&gt;"/tmp/my_report.xlsx"&lt;/SPAN&gt;,
    &lt;SPAN class="hljs-string"&gt;"/Volumes/main/reporting/reports_archive/my_report.xlsx"&lt;/SPAN&gt;
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="l8rrz23 _1ibi0s3d6 _1ibi0s332 _1ibi0s3do _1ibi0s3bm _1ibi0s3ce"&gt;
&lt;DIV class="lqznwq0"&gt;&lt;SPAN&gt;Once the file is in the volume, it’s stored in your external location and governed by Unity Catalog, which should cover your archive requirement.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="lqznwq0"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="lqznwq0"&gt;&lt;SPAN&gt;Some docs for reference:&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;UL&gt;
&lt;LI class="p8i6j01 paragraph"&gt;See "Ephemeral storage" and "Move data from ephemeral storage to volumes" -&amp;nbsp;&amp;nbsp;&lt;A class="ln4xub1 _1ibi0s36w _1ibi0s3e4 _1ibi0s3cg markdown-link _1ibi0s376" href="https://learn.microsoft.com/en-us/azure/databricks/files/" rel="noreferrer" target="_blank"&gt;&lt;SPAN class="f8uo5q0"&gt;https://learn.microsoft.com/en-us/azure/databricks/files/&lt;/SPAN&gt;&lt;/A&gt;&lt;/LI&gt;
&lt;LI class="p8i6j01 paragraph"&gt;See&amp;nbsp;how /Volumes/... works, examples with POSIX paths and dbutils.fs -&amp;nbsp;&lt;A class="ln4xub1 _1ibi0s36w _1ibi0s3e4 _1ibi0s3cg markdown-link _1ibi0s376" href="https://learn.microsoft.com/en-us/azure/databricks/volumes/volume-files" rel="noreferrer" target="_blank"&gt;&amp;nbsp;&lt;SPAN class="f8uo5q0"&gt;https://learn.microsoft.com/en-us/azure/databricks/volumes/volume-files&lt;/SPAN&gt;&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;DIV class="tk0j8o1 _1ibi0s31a _1ibi0s3dn"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="tk0j8o1 _1ibi0s31a _1ibi0s3dn"&gt;Try this and let me know if you have further questions..&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="tk0j8o1 _1ibi0s31a _1ibi0s3dn"&gt;
&lt;P class="p1"&gt;&lt;STRONG&gt;&lt;FONT size="2" color="#FF6600"&gt;&lt;I&gt;If this answer resolves your question, could you mark it as “Accept as Solution”? That helps other users quickly find the correct fix.&lt;/I&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/DIV&gt;</description>
    <pubDate>Thu, 12 Mar 2026 10:57:07 GMT</pubDate>
    <dc:creator>Ashwin_DSA</dc:creator>
    <dc:date>2026-03-12T10:57:07Z</dc:date>
    <item>
      <title>Copy files from /tmp to abfss location</title>
      <link>https://community.databricks.com/t5/administration-architecture/copy-files-from-tmp-to-abfss-location/m-p/150651#M5008</link>
      <description>&lt;P&gt;I have a notebook which generates a bunch of excel and pdf reports. These reports needs to be sent out through email and also needs to be archived in external location.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;i am able to generate these reports in the /tmp file and then send them as attachments. But to archive it , when i try to copy it to the external location it is throwing the error: insufficient access.&lt;/P&gt;&lt;P&gt;its a unity catalog enabled Databrics instance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;I have tried shutils and dbutils but shutils donot recognize the abfss path whereas dbutils donot recognize the /tmp path.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any suggestions would be very helpful&lt;/P&gt;&lt;P&gt;thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2026 05:08:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/copy-files-from-tmp-to-abfss-location/m-p/150651#M5008</guid>
      <dc:creator>deepu</dc:creator>
      <dc:date>2026-03-12T05:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: Copy files from /tmp to abfss location</title>
      <link>https://community.databricks.com/t5/administration-architecture/copy-files-from-tmp-to-abfss-location/m-p/150670#M5009</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/56679"&gt;@deepu&lt;/a&gt;,&lt;/P&gt;
&lt;P class="p8i6j01 paragraph"&gt;The reason it isn't working is that Python’s shutil only understands local/POSIX-style paths, not abfss:// URIs, and dbutils.fs expects Databricks-style paths (e.g., file:/..., /Volumes/...).&amp;nbsp;&lt;/P&gt;
&lt;P class="p8i6j01 paragraph"&gt;The recommended pattern for this is..&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Write reports to local disk (what you already do, /tmp).&lt;/LI&gt;
&lt;LI&gt;Copy from local disk --&amp;gt; a Unity Catalog volume (backed by your external location).&lt;/LI&gt;
&lt;LI&gt;Always reference the volume via /Volumes/... paths inside Databricks, not raw abfss:// from Python stdlib.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;On Unity Catalog enabled clusters, you’re dealing with two different file systems:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;/tmp is ephemeral local storage on the driver.&lt;/LI&gt;
&lt;LI&gt;abfss://... is remote cloud storage.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Firstly, back your external location with a UC volume if you haven't done that already. For example,&amp;nbsp;&lt;/P&gt;
&lt;DIV class="l8rrz21 _1ibi0s3dn" data-ui-element="code-block-container"&gt;
&lt;PRE&gt;&lt;CODE class="markdown-code-sql p8i6j0e hljs language-sql _12n1b832"&gt;&lt;SPAN class="hljs-keyword"&gt;CREATE&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;EXTERNAL&lt;/SPAN&gt; VOLUME main.reporting.reports_archive
  LOCATION &lt;SPAN class="hljs-string"&gt;'abfss://&amp;lt;container&amp;gt;@&amp;lt;account&amp;gt;.dfs.core.windows.net/&amp;lt;path&amp;gt;'&lt;/SPAN&gt;;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;P&gt;Make sure the user/service has USE CATALOG, USE SCHEMA and WRITE VOLUME on this volume.&lt;/P&gt;
&lt;DIV class="tk0j8o1 _1ibi0s31a _1ibi0s3dn"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="tk0j8o1 _1ibi0s31a _1ibi0s3dn"&gt;You can then copy from /tmp to the volume you created (as above)&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="l8rrz21 _1ibi0s3dn" data-ui-element="code-block-container"&gt;
&lt;PRE&gt;&lt;CODE class="markdown-code-python p8i6j0e hljs language-python _12n1b832"&gt;dbutils.fs.cp(
    &lt;SPAN class="hljs-string"&gt;"file:/tmp/my_report.xlsx"&lt;/SPAN&gt;,
    &lt;SPAN class="hljs-string"&gt;"/Volumes/main/reporting/reports_archive/my_report.xlsx"&lt;/SPAN&gt;,
    &lt;SPAN class="hljs-literal"&gt;True&lt;/SPAN&gt;  &lt;SPAN class="hljs-comment"&gt;# overwrite&lt;/SPAN&gt;
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="l8rrz23 _1ibi0s3d6 _1ibi0s332 _1ibi0s3do _1ibi0s3bm _1ibi0s3ce"&gt;
&lt;DIV class="lqznwq0"&gt;&lt;SPAN&gt;The &lt;/SPAN&gt;&lt;SPAN&gt;file:/&lt;/SPAN&gt;&lt;SPAN&gt; prefix is required for &lt;/SPAN&gt;&lt;SPAN&gt;dbutils.fs&lt;/SPAN&gt;&lt;SPAN&gt; to see local/ephemeral storage, and &lt;/SPAN&gt;&lt;SPAN&gt;/Volumes/...&lt;/SPAN&gt;&lt;SPAN&gt; is the POSIX-style path for your UC volume.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="tk0j8o1 _1ibi0s31a _1ibi0s3dn"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Alternatively, you can&amp;nbsp;use shutil against the volume path (not abfss):&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="l8rrz21 _1ibi0s3dn" data-ui-element="code-block-container"&gt;
&lt;PRE&gt;&lt;CODE class="markdown-code-python p8i6j0e hljs language-python _12n1b832"&gt;&lt;SPAN class="hljs-keyword"&gt;from&lt;/SPAN&gt; shutil &lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; copyfile

copyfile(
    &lt;SPAN class="hljs-string"&gt;"/tmp/my_report.xlsx"&lt;/SPAN&gt;,
    &lt;SPAN class="hljs-string"&gt;"/Volumes/main/reporting/reports_archive/my_report.xlsx"&lt;/SPAN&gt;
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="l8rrz23 _1ibi0s3d6 _1ibi0s332 _1ibi0s3do _1ibi0s3bm _1ibi0s3ce"&gt;
&lt;DIV class="lqznwq0"&gt;&lt;SPAN&gt;Once the file is in the volume, it’s stored in your external location and governed by Unity Catalog, which should cover your archive requirement.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="lqznwq0"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="lqznwq0"&gt;&lt;SPAN&gt;Some docs for reference:&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;UL&gt;
&lt;LI class="p8i6j01 paragraph"&gt;See "Ephemeral storage" and "Move data from ephemeral storage to volumes" -&amp;nbsp;&amp;nbsp;&lt;A class="ln4xub1 _1ibi0s36w _1ibi0s3e4 _1ibi0s3cg markdown-link _1ibi0s376" href="https://learn.microsoft.com/en-us/azure/databricks/files/" rel="noreferrer" target="_blank"&gt;&lt;SPAN class="f8uo5q0"&gt;https://learn.microsoft.com/en-us/azure/databricks/files/&lt;/SPAN&gt;&lt;/A&gt;&lt;/LI&gt;
&lt;LI class="p8i6j01 paragraph"&gt;See&amp;nbsp;how /Volumes/... works, examples with POSIX paths and dbutils.fs -&amp;nbsp;&lt;A class="ln4xub1 _1ibi0s36w _1ibi0s3e4 _1ibi0s3cg markdown-link _1ibi0s376" href="https://learn.microsoft.com/en-us/azure/databricks/volumes/volume-files" rel="noreferrer" target="_blank"&gt;&amp;nbsp;&lt;SPAN class="f8uo5q0"&gt;https://learn.microsoft.com/en-us/azure/databricks/volumes/volume-files&lt;/SPAN&gt;&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;DIV class="tk0j8o1 _1ibi0s31a _1ibi0s3dn"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="tk0j8o1 _1ibi0s31a _1ibi0s3dn"&gt;Try this and let me know if you have further questions..&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="tk0j8o1 _1ibi0s31a _1ibi0s3dn"&gt;
&lt;P class="p1"&gt;&lt;STRONG&gt;&lt;FONT size="2" color="#FF6600"&gt;&lt;I&gt;If this answer resolves your question, could you mark it as “Accept as Solution”? That helps other users quickly find the correct fix.&lt;/I&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 12 Mar 2026 10:57:07 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/copy-files-from-tmp-to-abfss-location/m-p/150670#M5009</guid>
      <dc:creator>Ashwin_DSA</dc:creator>
      <dc:date>2026-03-12T10:57:07Z</dc:date>
    </item>
  </channel>
</rss>

