FB_FTP_FileListEx

FB_FTP_FileListEx 1:

File and folder names can be read or searched from the FTP server with the function block FB_FTP_FileListEx. This function block uses an already open connection to an FTP server. In contrast to the function block FB_FTP_FileList, details of the files/folders are also returned.

FB_FTP_FileListEx 2: Inputs

VAR_INPUT
sNetID    : T_AmsNetId := '';
hFTP      : T_HFTP;
sMask     : T_MaxString:= '';
bRawValues: BOOL;
nIndex    : UDINT;
pList     : UDINT;
cbList    : UDINT;
bExecute  : BOOL;
tTimeout  : TIME       := T#20s;
END_VAR

Name

Type

Description

sNetID

T_AmsNetId

A string containing the AMS network ID of the target device, at which the ADS command is directed.

hFTP

T_HFTP

Handle of the FTP server.

sMask

T_MaxString

Search mask to filter corresponding files:

*.* Reads out all files.

* Reads out all files and all folder names.

*.txt Reads out all files with the extension "TXT".

\Test\*.* Reads out all files from the Test subfolder.

bRawValues

BOOL

Specifies in which form the file list should be returned:

TRUE: Information is returned in the form of a T_MaxString array.

FALSE: Information is returned in the form of a ST_FTP_FileDetails array. (Not supported by every FTP server).

nIndex

UDINT

Specifies the index of the first file to be read.

pList

UDINT

Specifies the address of the array into which the file list is to be written. Maximum array size 256 elements.

cbList

UDINT

Indicates the size of the array in bytes.

bExecute

BOOL

The function block is executed with the rising edge.

tTimeout

TIME

Indicates the timeout period.

FB_FTP_FileListEx 3: Outputs

VAR_OUTPUT
bBusy : BOOL;
bError: BOOL;
nErrID: UDINT;
nItems: UDINT;
END_VAR

Name

Type

Description

bBusy

BOOL

The command is in the process of being transmitted by ADS. No new command will be accepted as long as "bBusy" remains TRUE.

bError

BOOL

Becomes TRUE, as soon as an error occurs.

nErrID

UDINT

Returns the ADS error code if the bError output is set.

nItems

UDINT

Returns the total number of file list entries.

Requirements

Development Environment

Target Platform

PLC Libraries to include

TwinCAT v3.0 Build 3102

PC or CX (x86)

Tc2_FTP