<?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 using python reading from an attribute table in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/copy-files-using-python-reading-from-an-attribute/m-p/285414#M22059</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Done Curtis​&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 05 Jun 2015 02:28:12 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2015-06-05T02:28:12Z</dc:date>
    <item>
      <title>Copy files using python reading from an attribute table</title>
      <link>https://community.esri.com/t5/python-questions/copy-files-using-python-reading-from-an-attribute/m-p/285412#M22057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 8pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 8pt;"&gt;I have names of Tiff files as a field in an attribute table of a feature class. I want to move only those files from hundreds of other files from the source folder to another folder.&amp;nbsp; The attribute table has only .tiff extensions attached to the filenames but I need to copy all the associated files such as .aux, .ovr and .xml.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 8pt;"&gt;The script below is successful up to writing all the .tiff files but my issue is how to copy the rest of the associated files for each raster. Maybe fnmatch or glob module will to the job but I am not sure how to use them. Any help is appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 8pt;"&gt;Adreeta&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 8pt;"&gt;&lt;SPAN style="font-family: Times New Roman;"&gt; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;import os&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;import arcpy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;import os.path&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;import shutil&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;featureclass = "C:\\work_Data\\Export_Output.shp"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;src = "C:\\Data\\UC_Training_Areas"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;dst = "C:\\Data\\Script"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 8pt;"&gt;&lt;SPAN style="font-family: Times New Roman;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 8pt;"&gt;rows = arcpy.SearchCursor(featureclass)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 8pt;"&gt;row = rows.next()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;while row:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;print row.Label&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;shutil.move(os.path.join(src,str(row.Label)),dst)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;row = rows.next()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 8pt;"&gt;&lt;SPAN style="font-family: Times New Roman;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 8pt;"&gt;--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 8pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 8pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 8pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 8pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 8pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 8pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 8pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 8pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 8pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 8pt;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2015 01:44:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-files-using-python-reading-from-an-attribute/m-p/285412#M22057</guid>
      <dc:creator>ADREETATHAKUR</dc:creator>
      <dc:date>2015-06-05T01:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Copy files using python reading from an attribute table</title>
      <link>https://community.esri.com/t5/python-questions/copy-files-using-python-reading-from-an-attribute/m-p/285413#M22058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please move this thread to &lt;A href="https://community.esri.com/space/2145" target="_blank"&gt;Python&lt;/A&gt;​. (This place is for help with the Geonet website.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The way to move all the ancillary files with the tiff is to use arcpy to call the ArcGIS tool CopyRaster.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import os
import arcpy

featureclass = "C:\\work_Data\\Export_Output.shp"
src = "C:\\Data\\UC_Training_Areas"
dst = "C:\\Data\\Script"
rows = arcpy.SearchCursor(featureclass)
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print row.Label
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyRaster_management(os.path.join(src, row.Label), os.path.join(dst, row.Label))
del row, rows&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:48:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-files-using-python-reading-from-an-attribute/m-p/285413#M22058</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-11T13:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: Copy files using python reading from an attribute table</title>
      <link>https://community.esri.com/t5/python-questions/copy-files-using-python-reading-from-an-attribute/m-p/285414#M22059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Done Curtis​&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jun 2015 02:28:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-files-using-python-reading-from-an-attribute/m-p/285414#M22059</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-06-05T02:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: Copy files using python reading from an attribute table</title>
      <link>https://community.esri.com/t5/python-questions/copy-files-using-python-reading-from-an-attribute/m-p/285415#M22060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Curtis, it worked perfectly.&lt;/P&gt;&lt;P&gt;Adreeta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Jun 2015 00:16:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-files-using-python-reading-from-an-attribute/m-p/285415#M22060</guid>
      <dc:creator>ADREETATHAKUR</dc:creator>
      <dc:date>2015-06-06T00:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: Copy files using python reading from an attribute table</title>
      <link>https://community.esri.com/t5/python-questions/copy-files-using-python-reading-from-an-attribute/m-p/285416#M22061</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As a note, if you're just copying the rasters exactly as they are (no change to compression, format, etc), then the arcpy.Copy_management might be the better tool.&amp;nbsp; It's faster (I've seen 30sec vs 3 mins for TIF), still copies all the related files (ovr, etc), and I've seen the arcpy.CopyRaster_management tool change your file sizes due to the fact that raster pyramid creation is set to ON by default.&amp;nbsp; You would have to make sure your environment settings are changed if you want to avoid this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Jun 2015 00:56:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-files-using-python-reading-from-an-attribute/m-p/285416#M22061</guid>
      <dc:creator>ToddBlanchette</dc:creator>
      <dc:date>2015-06-06T00:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: Copy files using python reading from an attribute table</title>
      <link>https://community.esri.com/t5/python-questions/copy-files-using-python-reading-from-an-attribute/m-p/285417#M22062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Todd, very helpful tip.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Jun 2015 01:03:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-files-using-python-reading-from-an-attribute/m-p/285417#M22062</guid>
      <dc:creator>ADREETATHAKUR</dc:creator>
      <dc:date>2015-06-07T01:03:35Z</dc:date>
    </item>
  </channel>
</rss>

