Listing all files/folders on the FTP root directory
Configure the tFTPFileList
component, the tIterateToFlow component, and the
tLogRow component to iterate all files and folders on
the FTP root directory and display the names and paths of these files and folders on the
console of
Talend Studio
.
-
Double-click the tFTPFileList
component to open its Basic settings view.
-
Specify the connection details required to access the FTP server. In
this example, select the Use an existing connection
check box and from the Component list drop-down
list displayed, select the connection component to reuse its connection details you
have already defined. -
In the Remote directory field, specify
the FTP server directory on which the files and folders will be iterated. In this
example, it is /, which means the root directory
of the FTP server. -
Clear the Move to the current
directory check box. -
Double-click the tIterateToFlow
component to open its Basic settings view.
-
Click the

button next to Edit schema to
open the schema dialog box.
-
Click the

button to add two String type columns
filename and filepath
that will hold the names and paths of the files to be iterated respectively. When
done, click OK to close the dialog box. -
In the Mapping table, set the values
for the filename and filepath columns. In this example, the global variable ((String)globalMap.get(“tFTPFileList_1_CURRENT_FILE”))
for filename and the global variable ((String)globalMap.get(“tFTPFileList_1_CURRENT_FILEPATH”)) for
filepath.Note that you can fill the values by pressing Ctrl + Space to access the global variables list and then selecting
tFTPFileList_1_CURRENT_FILE and
tFTPFileList_1_CURRENT_FILEPATH from the list. -
Double-click the tLogRow component to
open its Basic settings view, and then select
Table (print values in cells of a table) in the
Mode area for better readability of the
result.