I am working on a script to rename and copy a large raster data set, in folders containing .prj, .tfwx, .tif.aux.xml, .ovr, and .tif.xml files with each .tif image. In running a simple rename and shutil.copy script (below) I lose parts of the metadata:
...
filCnt = 0
for file in files:
# Slice off 1st 4 digits of file name
num = file[0:4]
if num == "1982":
filCnt = filCnt + 1
sStg = 0
sStg = file.find('L') # A few files contain L
if sStg > 8 and sStg < 15:
newFile = file[sStg+2:]
shutil.copy(file,outDir+newFile)
print newFile
sStg = file.find('l') # A few files contain l
if sStg > 8 and sStg < 15:
newFile = file[sStg+2:]
shutil.copy(file,outDir+newFile)
print newFile
How can I modify this to keep the renaming convention, but use another copying procedure? The Copy Raster tool ignores the associated files and I would prefer not creating a database for this, given the amount of data. Any ideas? Thank you!
Running 10.3 btw