Retrieving files from an FTP server
Retrieving files from an FTP server for processing is a very common operation for GIS programmers and can be automated with a Python script.
Getting ready
Connecting to an FTP
server and downloading a file is accomplished through the ftplib
module. A connection to an FTP server is created through the FTP object, which accepts a host, username, and password to create the connection. Once a connection has been opened, you can then search for and download files.
In this recipe, you will connect to the National Interagency Fire Center Incident FTP site and download a Google Earth format file for a wildfire in Alaska.
How to do it…
Follow these steps to create a script that connects to an FTP server and downloads ...
Get Programming ArcGIS 10.1 with Python Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.