This function deletes a file on the FTP server.
Input:
ID : INT
The ID returned from ftpConnect.
Name : STRING
Name of the file to delete. Both absolute and relative paths are allowed.
Returns: INT
0
|
|
- Success.
|
- 1
|
|
- Delete failed, see ftpLastResponse.
|
- 2
|
|
- Invalid ID.
|
- 3
|
|
- Invalid name
|
- 4
|
|
- Session is busy with another operation.
|
- 5
|
|
- FTP not open, use ftpOpen to open interface.
|
- 10
|
|
- Communication with server not possible.
|
Declaration:
FUNCTION ftpFileDelete : INT;
VAR_INPUT
ID : INT;
Name : STRING;
END_VAR;
Example:
INCLUDE rtcu.inc
PROGRAM example;
VAR
open : BOOL;
host : STRING := "ftp.domain.com";
usr : STRING := "ftpuser";
pwd : STRING := "user pwd";
name : STRING := "test.txt";
id : INT;
END_VAR;
gsmPower(power := ON);
gprsOpen();
BEGIN
open := (ftpOpen() = 0);
IF open THEN
id := ftpConnect(host := host, username := usr, password := pwd);
ftpFileDelete(id := id, name := name);
ftpDisconnect(id := id);
END_IF;
ftpClose();
END;
END_PROGRAM;
|