Please find my script below currently all i'm wanting to do is iterate through a folder and any subfolders extracting anything that is a .gdb directory + its contents to a new folder.
import shutil, errno, re, os results =  input_path = r"D:\Profiles\cdixon\Documents\BaseFolder" output_path = r"D:\Profiles\cdixon\Documents\Extracted_GDBS" for path, subdirs, files in os.walk(input_path): for dir_name in subdirs: if os.path.join(path, dir_name).endswith(".gdb") or os.path.join(path, dir_name).endswith(".GDB"): print "Moving " + os.path.join(path, dir_name) + " To " + output_path shutil.copytree(os.path.join(path, dir_name), output_path)
However when ran I get the error, despite the fact that the Extracted_GDBS folder is empty
WindowsError: [Error 183] Cannot create a file when that file already exists
If anyone has any ideas how I can fix this that would be great. I've seen some test scripts on here that kind of do what I'm looking for but given I'm not opening up any of the files or doing manipulation, aside from a copy/move, I think this should be ok without using any ESRI Arc libaries.