How to create File Polling with more than one File Name Filter?

I want to create a File Pooling (Admin Home → Ports → Add Port → webMethods/FilePolling) with more than one File Name Filter.

For example, I want to have two File Name Filters like these:
CS_.txt
CS_
.csv

But the problem is there is only one textfield for the File Name Filter. So, Is there any syntax to specify more than one File Name Filter?

According the IS Administrator’s guide, the file polling port supports pattern matching characters but not regex. So there is not a way to specify a filename pattern to match the 2 filename patterns that you want other than CSV_.

So that means I have to create two file poolings?

Either that or apply the filtering within the service that is called by the file polling port.

Another caution: be careful about having 2 or more file polling ports watching the same directory. They may interfere with each other.

Configure the File Name Filter as below,

File Name Filter (optional) = CS_*.[tc][xs][tv]

File polling port supports both CS_.txt and CS_.csv files.

Have you tried doing this? Per what I see in the docs, regex is not supported.

Hey, it’s working… Thanks :slight_smile:

I saw in IS Administrator Guide, page 95, it’s said that:

Pattern matching means regex, I think.

The documentation is not quite clear about this.

I saw that too and later it describes pattern matching as supporting * and ?.

Have you tried a file with a name that is close but the polling port should not pick up? Like CS_*.tmp

Yes, I tried with CS_2011.doc and it’s not picked. So I guess it really supports regex anyway.

Hmm. If it is regex, then the pattern doesn’t seem right.

CS_*.[tc][xs][tv]

The * indicates 0 or more of the preceding char.

The . indicates any char.

The char sets would mean all of the following would match:

txt, txv, tst, tsv, cxt, cxv, cst, csv

If it is regex, I would think the following would work:

CS_.*.(txt|csv)

This would express:

“CS_” literal followed by

0 or more chars followed by

“.” literal followed by

“txt” or “csv” literal

Based on the pattern you mentioned I’m not sure how it is matching the desired filenames. Can you give example filenames that it is picking up?

@reamon:

You’re correct about this. That pattern will also match file names like: CS_2011.txv, CS_2010.cxt, etc.

After doing some experiments, the pattern matching in file polling is not regex at all. As far I tried, the operators that I found working are:

  • = Matches any number of characters
    ? = Matches any single character
    = Match any character within the brackets

The operator “.”, “(”, “)”, and “|” don’t work like in regex. It’s regarded as plain character. I don’t know if there is other possible way to define logical OR of words (“txt|csv”), too bad the documentation doesn’t provide any detail information about the pattern matching operators.

So for now, to accurately match pattern CS_.txt and CS_.csv, I guess I have to create two file polling or create one file polling with the service doing some filtering for the filename. But for the later, there is a problem, once a file has been polled to the service, the file cannot return to monitoring directory, it will either go to completion directory (on exit flow with success), or to error directory (on exit with failure or if there is error/exception throwed), or to working directory (if service is stuck running, never return).

Thanks for sharing your investigation. It will undoubtedly help others.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.