You can use ft_delete() to delete a file or a directory in the remote system. File directories that are to be deleted must be empty.
In order to delete a file, the filetype parameter in the par structure must contain the value FT_FILE
.
To delete a directory, the filetype parameter in the par structure must contain the value FT_DIRECTORY
.
File names and directory names must not exceed the length specified in the maxrfnsize field of the ft_prop structure (see section “ft_properties - Determine properties of the program interface”).
Syntax
#include <ftapi.h> int ft_delete(const struct ft_admission *admis, /* input */ const struct ft_delpar *par, /* input */ struct ft_err *errorinfo, void *options); /* input */
Parameter
admis
Transfer admission for the remote system (see section “ft_admission” (Specifications concerning the remote system)).
par
Entries for delete request which you specify with the structure ft_delpar:
struct ft_delpar { int delparvers; /* input */ char *fn; /* input */ char *mgmtpasswd; /* input */ enum ft_filedir filetype; /* input */ char *fud; /* input */ int fudlen; /* input */ enum ft_fncmode fncmode; /* input */ };
The fields of the structure ft_delpar have the following meanings:
delparvers
Version of the data structure.
delparvers must be supplied the value FT_DPARV1
, FT_DPARV2
or FT_DPARV3
.
fn
Name of the file or directory to be deleted in the remote system.
Absolute and relative path names are permissible. Relative path names refer to the login name specified in the admission profile, when the FTAC function is used, otherwise to the HOME directory, see "File transfer".
mgmtpasswd
Password of the file/directory, if protected by a password.
filetype
specifies what is to be deleted:
FT_FILE
File (Default value after initialization of the parameter list ft_delpar with binary 0)
FT_DIRECTORY
Directory (not for FTAM partners)
fud
Address of a data area for the so-called "Further Details" which can indicate a more detailed cause of error if errors occur.
If NULL
is specified then no more detailed error cause is output. The fud parameter is only available if delparvers is set to the value FT_DPARV2
and the options parameter is specified when ft_delete is called.
fudlen
Length of the data area for fud.
The fudlen parameter is only available if delparvers is set to the value FT_DPARV2
and the options parameter is specified when ft_delete is called.
fncmode
Specifies the file-name encoding-mode.
FT_FNCTRANS
Specification of the remote file name and follow-up processing for the remote system in transparent mode (compatible to the previous version; default value after initialization with binary 0).
FT_FNCCHAR
Specification of the remote file name and follow-up processing for the remote system in character mode. They are interpreted according to the character code of the remote system, i.e. for UNIX partners according to the openFT operating parameter option (ftmodo –fnccs) that has been set there. –fnc=c is only permitted for openFT partners as of openFT V12.1B. This functionality is only available if delparvers is set to the value FT_DPARV3
and the Options parameter is specified when ft_transfer is called.
errorinfo
Area in which detailed information is stored if an error is encountered (see section “ft_err” (Error handling)).
The specification of this parameter is optional. If you do not require any more precise error information then you can specify the value NULL
for errorinfo.
options
The specification of the options parameter is optional. If the value NULL
is specified then message activity at the program interface is compatible with that of the program interface of openFT < V10.
Alternatively, it is possible to specify the ft_options structure (see section “ft_options” (Version of the program interface)) to activate the openFT message number scheme as of openFT V10 and the extensions to the function.
Return value
0 | No error. The file or directory has been deleted. |
-1 | Error. The file or directory has not been deleted. |