SFTP target file pattern

Specifies the target file name to use when copying files matching the SFTP source file pattern property from the SFTP server. The SFTP target file pattern property value can include $[1], $[2], $[3], ... to reference the 1st, 2nd, 3rd, ... captured groups from the SFTP source file pattern property. Captured groups in the SFTP source file pattern property are identified with parentheses.
Length
Up to 255 characters (bytes)
Default
If no value is specified, the original file names without paths are used as the target file names. Files with the same names located in different subdirectories will overwrite each other when they are written to the local file system.
Database name
SftpInput.TargetFilePattern

Examples:

In this example, the source file and the target file will have the same name:

  • SFTP Source File Pattern: ([a-zA-Z0-9]+)\\.([a-z]+)
  • SFTP Target File Pattern: $[1].$[2]

Matching file File1.pdf will be copied to the local system with the same file name File1.pdf. Matching file File2.pdf will be copied to the local system with the same file name File2.pdf.

In this example, the target file will have a name derived from the source file name path:

  • SFTP Source File Pattern: ([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9_-]+)\\.([a-zA-Z0-9]+)
  • SFTP Target File Pattern: $[1]@$[2]@$[3].$[4]

Matching file Company1/Invoices/Account027823_10-2017.pdf will be copied to the local system with the file name Company1@Invoices@Acount027823_10-2017.pdf. Matching file Company1/Letters/Letter1.pdf will be copied to the local system with the file name Company1@Letters@Letter1.pdf.

In this example, the target file name will always be the same, regardless of the name of the source file that is being copied (captured groups are not used in this example):

  • SFTP Source File Pattern: [a-zA-Z0-9]+\\.[a-z]+
  • SFTP Target File Pattern: NewFile

Matching file File1.pdf will be copied to the local system with the file name NewFile. Matching file File2.pdf will also be copied to the local system with the file name NewFile.