20102018 Ericsson AB. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ct_ftp A ct_ftp.xml
ct_ftp FTP client module (based on the FTP application).

FTP client module (based on the ftp application).

Data Types connection() = handle() | target_name()

For target_name, see module ct.

handle() = handle()

Handle for a specific FTP connection, see module ct.

cd(Connection, Dir) -> ok | {error, Reason} Changes directory on remote host. Connection = connection() Dir = string()

Changes directory on remote host.

close(Connection) -> ok | {error, Reason} Closes the FTP connection. Connection = connection()

Closes the FTP connection.

delete(Connection, File) -> ok | {error, Reason} Deletes a file on remote host. Connection = connection() File = string()

Deletes a file on remote host.

get(KeyOrName, RemoteFile, LocalFile) -> ok | {error, Reason} Opens an FTP connection and fetches a file from the remote host. KeyOrName = Key | Name Key = atom() Name = target_name() RemoteFile = string() LocalFile = string()

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.

For target_name, see module ct.

See also ct:require/2.

ls(Connection, Dir) -> {ok, Listing} | {error, Reason} Lists directory Dir. Connection = connection() Dir = string() Listing = string()

Lists directory Dir.

open(KeyOrName) -> {ok, Handle} | {error, Reason} Opens an FTP connection to the specified node. KeyOrName = Key | Name Key = atom() Name = target_name() 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.

For target_name, see module ct.

put(KeyOrName, LocalFile, RemoteFile) -> ok | {error, Reason} Opens an FTP connection and sends a file to the remote host. KeyOrName = Key | Name Key = atom() Name = target_name() LocalFile = string() RemoteFile = string()

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

LocalFile and RemoteFile must be absolute paths.

For target_name, see module ct.

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) -> ok | {error, Reason} Fetches a file over FTP.

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) -> ok | {error, Reason} Fetches a file over FTP. Connection = connection() RemoteFile = string() LocalFile = string()

Fetches a file over FTP.

The file is named LocalFile on the local host.

send(Connection, LocalFile) -> ok | {error, Reason} Sends a file over FTP.

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) -> ok | {error, Reason} Sends a file over FTP. Connection = connection() LocalFile = string() RemoteFile = string()

Sends a file over FTP.

The file is named RemoteFile on the remote host.

type(Connection, Type) -> ok | {error, Reason} Changes the file transfer type. Connection = connection() Type = ascii | binary

Changes the file transfer type.