Select to view content in your preferred language

Is there a way to download a .GDB from an FTP site...

1752
2
02-17-2012 07:36 AM
ZlatkoGrebenar1
Emerging Contributor
I have been struggling with this for a while now. I managed to download .dbf & .xml files just fine, but am stuck on downloading a .gdb from an FTP site.
Is there a way to do this without having to list every single file within the geodatabase.

Any help is much appreciated.


Thanks,

Zlatko Grebenar
City of Nampa GIS
grebenarz@cityofnampa.us
Tags (2)
0 Kudos
2 Replies
KimOllivier
Honored Contributor
Get the site to zip up the folder first. Then download the zip.
Or use the new package format (*.pkg) when exporting from ArcMap which is the same thing.
0 Kudos
ZlatkoGrebenar1
Emerging Contributor
Kim,

This is the code I am using to download the .dbf & xml tables.
# import FTP library
from ftplib import FTP

# This will handle the data being downloaded
def handleDownload(block):
    file.write(block)
    print ".",


# Log in to the server
ftp = FTP('NAME')
ftp.login('user', 'password')
# Go to a specific directory & get a list of contents
directory = 'gis/Taxlots/GIS_DATA/Tables'
print 'Changing to' + directory
ftp.cwd(directory)
ftp.retrlines('LIST')

# File to download
filename = 'Charac.dbf'

# Open the file for writing in binary mode
print 'Opening local file ' + filename
file = open('Charac.dbf', 'wb')

# Download the file
print 'Getting' + filename
ftp.retrbinary('RETR Charac.dbf', handleDownload)


file.close(); print 'Closing file' + filename

Within the .gdb there are multiple files that I need to download. Do you know of a way to download all files within the specific .gdb by using the code above to retrieve all files.

Thanks,

Zlatko Grebenar
grebenarz@cityofnampa.us
0 Kudos