Tuesday, 28 May 2019

How to list files from FTP resides in multiple directories: Oracle Integration Cloud

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 is the SFTP server directories details.

/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.

No comments:

Post a Comment