Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

Perform FTP File Operations

From MATLAB®, you can connect to an FTP server to perform remote file operations. The following procedure uses a public FTP server at the National Geophysical Data Center (NGDC). To perform any file operation on an FTP server, follow these steps:

  1. Connect to the server using the ftp function.

  2. Perform file operations using appropriate MATLAB FTP functions. For all operations, specify the server object.

  3. When you finish working on the server, close the connection object using the close function.

Example — Retrieve a File from an FTP Server

List the contents of the anonymous FTP service at the NGDC.

ngdc = ftp('ftp.ngdc.noaa.gov');
dir(ngdc)
 
DMSP                         Solid_Earth                  international            wdc                          
INDEX.txt                    ftp.html                     ionosonde                                        
README.txt                   geomag                       mgg                                                 
STP                          hazards                      pub                                                       
Snow_Ice                     index.html                   tmp                                                       

Retrieve a file named INDEX.txt. To view the file, use the type function.

mget(ngdc,'INDEX.txt');
type INDEX.txt
                    National Geophysical Data Center (NGDC)

                          INDEX of anonymous ftp area
                               ftp.ngdc.noaa.gov

DIRECTORY/FILE DESCRIPTION OF CONTENTS
-------------- -----------------------------------------------------------------
pub/           Public access area 
DMSP/          Defense Meteorological Satellite Data Archive
geomag/        Geomagnetism and geomagnetics models
hazards/       Natural Hazards data, volcanoes, tsunamis, earthquakes
international/ International program information on IAGA/Oersted/wdc
ionosonde/     Ionosonde data
mgg/           Limited Marine Geology and Geophysics (most data in http area)
OD/            Office of the Director, NGDC
Snow_Ice/      Snow and Ice Data Center
Solid_Earth/   Historic Solid Earth Geophysics
STP/           Solar-Terrestrial Physics
tmp/           Pickup area for temporary outgoing data
wdc/           World Data Service for Geophysics, formerly World Data Centers
-------------- -----------------------------------------------------------------
Please see file README.txt in this directory for more information and how to 
contact NGDC. Direct E-mail inquiries to ngdc.info@noaa.gov

Also see our web site: http://www.ngdc.noaa.gov/ngdc.html

NGDC is part of the:
U.S. Department of Commerce, National Oceanic and Atmospheric Administration (NOAA),
National Environmental Satellite, Data and Information Service (NESDIS)

View the contents of the pub folder:

cd(ngdc,'pub')
dir(ngdc)

Close the FTP connection.

close(ngdc)

FTP service courtesy of the NGDC. See NGDC Privacy Policy, Disclaimer, and Copyright for NGDC terms of service.

See Also

Was this topic helpful?