ftp - Connect to FTP server, creating FTP object

Syntax

f = ftp('host','username','password')

Description

f = ftp('host','username','password') connects to the FTP server, host, creating the FTP object, f. If a user name and password are not required for an anonymous connection, only use the host argument. Specify an alternate port by separating it from host using a colon (:). After running ftp, perform file operation functions on the FTP object, f, using methods such as cd and others listed under "See Also." When you're finished using the server, run close (ftp) to close the connection.

FTP is not a secure protocol; others can see your user name and password.

The ftp function is based on code from the Apache Jakarta Project.

Examples

Connect Without User Name

Connect to ftp.mathworks.com, which does not require a user name or password. Assign the resulting FTP object to tmw. You can access this FTP site to experiment with the FTP functions.

tmw=ftp('ftp.mathworks.com')

MATLAB® returns:

tmw =
 FTP Object
  host: ftp.mathworks.com
  user: anonymous
   dir: /
  mode: binary

Connect to Specified Port

To connect to port 34, type:

tmw=ftp('ftp.mathworks.com:34')

Connect with User Name

Connect to ftp.testsite.com and assign the resulting FTP object to test.

test=ftp('ftp.testsite.com','myname','mypassword')

MATLAB returns:

test =
 FTP Object
  host: ftp.testsite.com
  user: myname
   dir: /
  mode: binary
  myname@ftp.testsite.com
  /

See Also

ascii, binary, cd (ftp), close (ftp), delete (ftp), dir (ftp), mget, mkdir (ftp), mput, rename, rmdir (ftp)

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS