I need to copy a set of personal geodatabases from a master directory to a local working directory for processing. Here's my Python code:
import os
import shutil
dirlist=os.listdir("Z:\\COMMON\\GIS\\WORK\\Ron\\NEW")
dst="C:\\Arcwork\\parcelmdb"
mdblist=[]
for item in dirlist:
[INDENT] if item.lower().endswith("mdb"):
mdblist.append(item)
[/INDENT] for db in mdblist:
[INDENT] shutil.copyfile(db,dst)
[/INDENT]However, when run I get an error:
Traceback (most recent call last):
File "C:\Arcwork\GetMasterMDBList.py", line 11, in <module>
shutil.copyfile(item,dst)
File "C:\Python26\ArcGIS10.0\lib\shutil.py", line 52, in copyfile
fsrc = open(src, 'rb')
IOError: [Errno 2] No such file or directory: 'Bolton.mdb'
- I seems like the copyfile command has trouble reading the mdblist? I also tried to use the copyfile function in the first For loop (skipping the Append to list), but no luck. Any thoughts on how to intepret this error is great appreciated!