ct_ftp
FTP client module (based on the FTP support of the INETS application).
FTP client module (based on the FTP support of the INETS application).
Functions
cd(Connection, Dir) -> ok | {error, Reason}
Connection = connection()
Dir = string()
Change directory on remote host.
close(Connection) -> ok | {error, Reason}
Connection = connection()
Close the FTP connection.
delete(Connection, File) -> ok | {error, Reason}
Connection = connection()
File = string()
Delete a file on remote host
get(KeyOrName, RemoteFile, LocalFile) -> ok | {error, Reason}
KeyOrName = Key | Name
Key = atom()
Name = target_name() (see module ct)
RemoteFile = string()
LocalFile = string()
Open a ftp connection and fetch a file from the remote host.
RemoteFile
and LocalFile
must be
absolute paths.
The config file must be as for put/3.
See also: put/3, ct:require/2.
ls(Connection, Dir) -> {ok, Listing} | {error, Reason}
Connection = connection()
Dir = string()
Listing = string()
List the directory Dir.
open(KeyOrName) -> {ok, Handle} | {error, Reason}
KeyOrName = Key | Name
Key = atom()
Name = target_name() (see module ct)
Handle = handle()
Open an FTP connection to the specified node.
You can open one connection for a particular Name
and
use the same name as reference for all subsequent operations. If you
want the connection to be associated with Handle
instead
(in case you need to open multiple connections to a host for example),
simply use Key
, the configuration variable name, to
specify the target. Note that a connection that has no associated target
name can only be closed with the handle value.
See ct:require/2
for how to create a new Name
See also: ct:require/2.
put(KeyOrName, LocalFile, RemoteFile) -> ok | {error, Reason}
KeyOrName = Key | Name
Key = atom()
Name = target_name() (see module ct)
LocalFile = string()
RemoteFile = string()
Open a ftp connection and send 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 config file like this:
{node,[{ftp,IpAddr}]}.
If the target host is something else, e.g. a unix host, the config 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}
recv(Connection, RemoteFile, LocalFile) -> ok | {error, Reason}
Connection = connection()
RemoteFile = string()
LocalFile = string()
Fetch a file over FTP.
The file will be named LocalFile
on the local host.
send(Connection, LocalFile) -> ok | {error, Reason}
send(Connection, LocalFile, RemoteFile) -> ok | {error, Reason}
Connection = connection()
LocalFile = string()
RemoteFile = string()
Send a file over FTP.
The file will be named RemoteFile
on the remote host.
type(Connection, Type) -> ok | {error, Reason}
Connection = connection()
Type = ascii | binary
Change file transfer type