There are scenarios where we want to copy files from one SFTP location to another in Oracle Integration Cloud with the help of FTP adapter.

In this article, we’ll try to execute the same 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 FTP adapter which will be treated as the source SFTP 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 FTP adapter(under For each) which would be treated  as the source SFTP, 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 the FTP adapter again which would be treated as Target SFTP, 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 define the schema for this endpoint? and click the Next button
  • Edit the TargetFTP mapper and map below fields:
    • ReadFile->SynchReadFileResponse->FileReadResponse->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
  • Integration is completed now. It time to test.
  • Below are the files on the  source FTP
  • Submit the integration and see all files from source FTP should be copied on target FTP