Copy files from one SFTP to another in OIC
There are scenarios where we want to copy files from one SFTP location to another in Oracle Integration Cloud.
In this article, I will show you how to copy files from one SFTP to another irrespective of the type of files.
Let’s see how to achieve this.
- Create a scheduler integration
- Drop the source FTP adapter and enter the name of the endpoint(ListFiles)
- Configure properties as below and click on the Next button
- Select Operation: List File
- Input Directory: Enter the directory from which files to be listed
- File Name Pattern: *
- Complete the wizard
- Drop For-Each activity just below the FTP adapter and configure properties as below
- Name: LoopOverTheFiles
- Repeating Element: Drop the repeated element of ListFile Response
- Current Element Name: CurrentFile
- Drop the same source FTP adapter(under For each), enter the name of endpoint(ReadFile) and click the Next button
- Configure properties as below and click on the Next button
- Select Operation: Read File
- Input Directory: Enter the directory from where the files to be read
- File Name Pattern: abc.tmp
- Select No radio button from Do you want to define the schema for this endpoint? and click the Next button
- Complete the wizard
- Edit the ReadFile mapper and do the mapping as below:
- CurrentFile/File/directory ——> SyncReadFile/FileReadRequest/directory
- CurrentFile/File/filename ——> SyncReadFile/FileReadRequest/filename
- Drop target FTP adapter, enter the name of endpoint(TargetFTP) and click the Next button
- Configure properties as below and click on the Next button
- Select Operation: Write File
- Specify an Onput Directory: Enter the directory where the file to be written
- File Name Pattern: abc.tmp
- Select No radio button from Do you want to specify the structure for the contents of the file nd click the Next button
- Edit the TargetFTP mapper and map below fields:
- ReadFile/SynchReadFileResponse/FileReadRespons/FTPResponseHeader->filename —> WriteFile/OutboundFTPHeaderType/filename
- ReadFile/SynchReadFileResponse/FileReadResponse/ICSFile/FileReference —> WriteFile/ICSFile/FileReference
- ReadFile/SynchReadFileResponse/FileReadResponse/ICSFile/Properties/filetype —> WriteFile/ICSFile/Properties/filetype
- ReadFile-/SynchReadFileResponse/FileReadResponse/ICSFile/Properties/filename—> WriteFile/ICSFile/Properties/filename
- All the required configurtion is completed. Let’ move ahead and test the integration.
- Below are the files on my source FTP and after the integration is executed, all these files will be copied to another FTP.
- Submit the integration and see all files from source FTP should be copied to target FTP
Look at my YouTube channel for OIC related video and Subscribe to YouTube channel to get the latest updates.