ftp

Create an FTP object to connect to a remote FTP server.

Attention: Valid only with Altair Communication Extension.

Syntax

ftpObj = ftp(address)

ftpObj = ftp(address, port)

ftpObj = ftp(address, username, password)

ftpObj = ftp(address, port, username, password)

Inputs

address
Address of the remote FTP server.
Type: string
port
Numeric port number to connect to.
Type: scalar
username
Username for authentication.
Type: string
password
Password for authentication.
Type: string

Outputs

ftpObj
FTP object with the following fields:
  • Host: address of the FTP server
  • Port: port number of the connection
  • Username: username used for authentication
  • Dir: current directory on the FTP server
  • Mode: data transfer mode (ascii or binary)

Example:

Connecting to an FTP server:

% Create the FTP object - the connection to the server is not established yet
ftpObj = ftp('ftp://127.0.0.1:60000','user', 'password');
% An attempt to connect to the server is made the first time a command to interract with the server is executed.
% Show the contents of the current directory in the FTP server.
dir(ftpObj)
close(ftpObj);
ans = drwxrwxrwx   1 owner    group           0 Feb 19 08:53 Folder1
drwxrwxrwx   1 owner    group           0 Feb 19 08:53 Folder2
-rw-rw-rw-   1 owner    group           0 Feb 19 08:53 file1.txt
-rw-rw-rw-   1 owner    group           0 Feb 19 08:53 file2.txt