Connect to FTP server
Connect to an FTP server by calling the
which creates an FTP object. Perform file operations using methods
on the FTP object, such as
When you finish accessing the server, call the
to close the connection.
to the FTP server
f = ftp(
host and creates FTP object
If the host supports anonymous connections, you can use the
alone. To specify an alternate port, separate it from
a colon (
String enclosed in single quotation marks that specifies the FTP server.
String enclosed in single quotation marks that specifies your user name for the FTP server.
String enclosed in single quotation marks that specifies your password for the FTP server. Because FTP is not a secure protocol, others can see your user name and password.
|ascii||Set FTP transfer type to ASCII|
|binary||Set FTP transfer type to binary|
|cd||Change or view current folder on FTP server|
|close||Close connection to FTP server|
|delete||Remove file on FTP server|
|dir||View contents of folder on FTP server|
|mget||Download files from FTP server|
|mkdir||Create folder on FTP server|
|mput||Upload file or folder to FTP server|
|rename||Rename file on FTP server|
|rmdir||Remove folder on FTP server|
Handle. To learn how handle classes affect copy operations, see Copying Objects in the MATLAB® documentation.
Modify the following code to connect to an FTP server, and display the FTP object:
mw = ftp('ftp.testsite.com'); disp(mw)
Connect to port 34 (not supported at
so this code returns an error):
mw = ftp('ftp.mathworks.com:34')
Modify the following code to connect to a host that requires a password:
test = ftp('ftp.testsite.com','myname','mypassword')
ftp function is based on code from
the Apache Jakarta Project.
ftp function does not support proxy