List files from FTP reside in multiple directories: OIC
The FTP Adapter enables the integration of the File Transfer Protocol (FTP) and the Secure Shell (SSH) File Transfer Protocol (sFTP) into Oracle Integration Cloud Service. Using the FTP Adapter, Oracle Integration Cloud Service can retrieve files for processing in Oracle Integration Cloud Service and can upload files and messages from Oracle Integration Cloud Service to a directory on a remote FTP server. FTP adapter also provides an operation to list files from directory and subdirectories.
See the Oracle official documentation of all available operation of the FTP (File Transfer Protocol) adapter.
Some useful links of the FTP adapter
In this article, We’ll try to solve a generic problem to list files from multiple directories of an SFTP server in a single integration.
Below are the directories and subdirectories which are on SFTP server which we’ll try to list using FTP adapter
/home/opc/source
-file1.PNG
-file2.txt
-file3.pptx
-file4.csv
/Test1
-file6.xml
/Test2
-file5.sh
There are a total of 6 files under all directory and sub-directories
During implementation, we’ll provide the /home/opc/source as the parent directory to list all the files and Oracle Integration cloud will read all the files from the directories and sub-directories.Let’s see how to achieve this.
- Create a Scheduled based Integration
- Drop the FTP adapter
- Enter the endpoint name as ListFiles and click on the Next button
- Configure properties as below and click on the Next button
- Select Operation: List File
- Input Directory: Enter the directory (/home/opc/source) from which files to be listed
- File Name Pattern: *
- Finish the wizard
Let’s save and close the Integration. Submit the integration and see the “Activity Stream” to check if all the files from directory and sub-directories have been listed
Notice the <ItemCount> node which shows the total number of files which means all the files have been listed.