There is a file geodatabase sitting on an ftp site that I would like to download with a Python script. Right now I'm thinking one way to do this is to copy the ftp geodatabase to a geodatabase on my computer. Below is the script I've started.
Does anyone know how I can alter this script so that I obtain ftp gdb?
Below is my final, working code as based on the answer @om_hennners provided.
import arcpy, os, sys from arcpy import env arcpy.env.overwriteOutput = True from ftplib import FTP directory = "/group/geodb" #location of gdb on ftp folder = "D:\\temp\\" out_gdb = "data.gdb" out_path = folder + os.sep + out_gdb copy_gdb = "hydro.gdb" # This is the gdb I would like to copy from the ftp site ftp = FTP("10.4.2.22") ftp.login("user", "pass") ftp.cwd(os.path.join(directory, copy_gdb)) print "Changed to " + os.path.join(directory, copy_gdb) filenames = ftp.nlst() print filenames print "starting to write" for f in filenames: with open(os.path.join(out_path, f), 'wb') as local_file: ftp.retrbinary('RETR '+ f, local_file.write) ftp.close() print "closed ftp connection"