cancel
Showing results for 
Search instead for 
Did you mean: 

SFTP Sender Channel - Regex for Filenames

former_member105769
Participant
0 Kudos

Hi

I understand that the "filename"  parameter for the SFTP adapter takes a regular expression.

I have a simple requirement, for 2 sender channels:

1) Select only files containing the string TEST anywhere in the filename

2) Select only files which do not contain the string TEST anywhere in the filename

I am unable to get this to work, even for the simple scenario 1.  I have tried various regular expressions, but the result is always Found 0 files

If I change the value to .* it correctly retrieves all files in the directory, including those with TEST in the filename.

Any suggestions please?

Regards

Steve

Accepted Solutions (1)

Accepted Solutions (1)

justin_santhanam
Active Contributor
0 Kudos

Hello Steve,

I haven't used this. But can you try with the below option as per the note, I guess you need to give ".*TEST.*"

1988592 - SFTP Adapter not picking files with *


Cause

The syntax to include placeholders in the file name field on the SFTP adapter is different from the syntax used on the File adapter.

Resolution

In order to work with placeholders on the file name parameter the value needs to be separated by a dot ".", such as "test.*.xml" instead of "test*.xml".

Placeholders are supported on the SFTP adapter since the correct syntax is used.

Not sure if it helps, give a try!

Answers (2)

Answers (2)

vicky20691
Active Contributor
0 Kudos

Hi Stephen,

1. For files containing TEST in file name

   .*TEST.*   ( dot star TEST dot *) - .* is wild card entry in regex

2. the second requirement has to be handled with exclusion mask

in the exclusion mask type .*TEST.*  and in the file name .*

follow these links for reference-

How to mask a file in SFTP adapter | SCN

Regards,

Vikas

justin_santhanam
Active Contributor
0 Kudos

For the exclusion , can you try the same way proposed in the below thread?

Can you try the below one?


^((?!TEST).)*$


Thanks!