ct_ftp (common_test v1.30)

Copy Markdown View Source

FTP client module (based on the ftp application).

Summary

Types

Reference to opened FTP connection associated to either a handle or target_name.

Handle for a specific FTP connection, see module ct.

Functions

cd(Connection, Dir) deprecated

Changes directory on remote host.

close(Connection) deprecated

Closes the FTP connection.

Deletes a file on remote host.

Opens an FTP connection and fetches a file from the remote host.

ls(Connection, Dir) deprecated

Lists directory Dir.

open(KeyOrName) deprecated

Opens an FTP connection to the specified node.

Opens an FTP connection and sends a file to the remote host.

Fetches a file over FTP.

Fetches a file over FTP.

Sends a file over FTP.

Sends a file over FTP.

Changes the file transfer type.

Types

connection()

-type connection() :: handle() | ct:target_name().

Reference to opened FTP connection associated to either a handle or target_name.

handle()

-type handle() :: ct:handle().

Handle for a specific FTP connection, see module ct.

Functions

cd(Connection :: connection(), Dir :: file:filename()) -> Result

This function is deprecated. ct_ftp:cd/2 is deprecated; Legacy protocol support will be dropped in OTP-30.

Types

Result = ok | {error, Reason}
Reason = term()

Changes directory on remote host.

close(Connection :: connection()) -> Result

This function is deprecated. ct_ftp:close/1 is deprecated; Legacy protocol support will be dropped in OTP-30.

Types

Result = ok | {error, Reason}
Reason = term()

Closes the FTP connection.

delete(Connection, File) -> Result

This function is deprecated. ct_ftp:delete/2 is deprecated; Legacy protocol support will be dropped in OTP-30.

Types

Connection = connection()
File = file:filename()
Result = ok | {error, Reason}
Reason = term()

Deletes a file on remote host.

get(KeyOrName, RemoteFile, LocalFile) -> Result

This function is deprecated. ct_ftp:get/3 is deprecated; Legacy protocol support will be dropped in OTP-30.

Types

KeyOrName = ct:key_or_name()
RemoteFile = LocalFile = file:filename()
Result = ok | {error, Reason}
Reason = term()

Opens an FTP connection and fetches a file from the remote host.

RemoteFile and LocalFile must be absolute paths.

The configuration file must be as for ct_ftp:put/3.

See also ct:require/2.

ls(Connection, Dir) -> Result

This function is deprecated. ct_ftp:ls/2 is deprecated; Legacy protocol support will be dropped in OTP-30.

Types

Connection = connection()
Dir = file:filename()
Result = {ok, Listing} | {error, Reason}
Reason = term()
Listing = string()

Lists directory Dir.

open(KeyOrName :: ct:key_or_name()) -> Result

This function is deprecated. ct_ftp:open/1 is deprecated; Legacy protocol support will be dropped in OTP-30.

Types

Result = {ok, Handle} | {error, Reason}
Reason = term()
Handle = handle()

Opens an FTP connection to the specified node.

You can open a connection for a particular Name and use the same name as reference for all following subsequent operations. If you want the connection to be associated with Handle instead (if you, for example, need to open multiple connections to a host), use Key, the configuration variable name, to specify the target. A connection without an associated target name can only be closed with the handle value.

For information on how to create a new Name, see ct:require/2.

put(KeyOrName, LocalFile, RemoteFile) -> Result

This function is deprecated. ct_ftp:put/3 is deprecated; Legacy protocol support will be dropped in OTP-30.

Types

KeyOrName = ct:key_or_name()
LocalFile = RemoteFile = file:filename()
Result = ok | {error, Reason}
Reason = term()

Opens an FTP connection and sends a file to the remote host.

LocalFile and RemoteFile must be absolute paths.

If the target host is a "special" node, the FTP address must be specified in the configuration file as follows:

{node,[{ftp,IpAddr}]}.

If the target host is something else, for example, a UNIX host, the configuration file must also include the username and password (both strings):

{unix,[{ftp,IpAddr},
       {username,Username},
       {password,Password}]}.

See also ct:require/2.

recv(Connection, RemoteFile) -> Result

This function is deprecated. ct_ftp:recv/2 is deprecated; Legacy protocol support will be dropped in OTP-30.

Types

Connection = connection()
RemoteFile = file:filename()
Result = ok | {error, Reason}
Reason = term()

Fetches a file over FTP.

The file gets the same name on the local host.

See also ct_ftp:recv/3.

recv(Connection, RemoteFile, LocalFile) -> Result

This function is deprecated. ct_ftp:recv/3 is deprecated; Legacy protocol support will be dropped in OTP-30.

Types

Connection = connection()
RemoteFile = LocalFile = file:filename()
Result = ok | {error, Reason}
Reason = term()

Fetches a file over FTP.

The file is named LocalFile on the local host.

send(Connection, LocalFile) -> Result

This function is deprecated. ct_ftp:send/2 is deprecated; Legacy protocol support will be dropped in OTP-30.

Types

Connection = connection()
LocalFile = file:filename()
Result = ok | {error, Reason}
Reason = term()

Sends a file over FTP.

The file gets the same name on the remote host.

See also ct_ftp:send/3.

send(Connection, LocalFile, RemoteFile) -> Result

This function is deprecated. ct_ftp:send/3 is deprecated; Legacy protocol support will be dropped in OTP-30.

Types

Connection = connection()
LocalFile = RemoteFile = file:filename()
Result = ok | {error, Reason}
Reason = term()

Sends a file over FTP.

The file is named RemoteFile on the remote host.

type(Connection :: connection(), Type :: ascii | binary) -> Result

This function is deprecated. ct_ftp:type/2 is deprecated; Legacy protocol support will be dropped in OTP-30.

Types

Result = ok | {error, Reason}
Reason = term()

Changes the file transfer type.