AnsweredAssumed Answered

Copy files using python reading from an attribute table

Question asked by ADREETA on Jun 4, 2015
Latest reply on Jun 6, 2015 by ADREETA

 

 

 

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.  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.

 

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.

 

Adreeta

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

import os

 

import arcpy

 

import os.path

 

import shutil

 

featureclass = "C:\\work_Data\\Export_Output.shp"

 

src = "C:\\Data\\UC_Training_Areas"

 

dst = "C:\\Data\\Script"

 

 

 

rows = arcpy.SearchCursor(featureclass)

 

row = rows.next()

 

while row:

 

     print row.Label

 

     shutil.move(os.path.join(src,str(row.Label)),dst)

 

     row = rows.next()

 

 

 

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Outcomes