ftpDirCreate (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

2.10 / 1.00.00


This function creates a directory on the FTP server.

 

The ftpDirCreate function does not work recursively and only tries to create the specified directory. If any of the directories in the path (if absolute) do not exist, the function may fail depending on how the server handles the request.

 

 

Input:

ID : INT

The ID returned from ftpConnect.

 

Name : STRING

Name of the directory to create. Both absolute and relative paths are allowed.

 

Returns: INT

0


- Success.

- 1


- Failed to create directory, see ftpLastResponse.

- 2


- Invalid ID.

- 4


- Session is busy with another operation.

- 5


- FTP not open, use ftpOpen to open interface.

- 10


- Communication with server not possible.

 

Declaration:

FUNCTION ftpDirCreate : 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";
 
  dir   : STRING := "test";
  id   : INT;
END_VAR;
 
  gsmPower(power := ON);
  gprsOpen();
 
BEGIN
 open := (ftpOpen() = 0);
IF open THEN
    id := ftpConnect(host := host, username := usr, password := pwd);
    ftpDirCreate(id := id, name := dir);
    ftpDisconnect(id := id);
END_IF;
ftpClose();
END;
END_PROGRAM;