0
votes

I am using Anypoint Studio 7 and Mule 4.1.

A product file in csv format with a filename that will include the current timestamp will be added to a directory on a daily basis and needs to be processed. To do this we are creating a mule workflow using the file connector and want to configure the file path field to only read csv file formats regardless of name.

At the moment, the only way I can get it to work is by specifying the filename in the file path field which looks like this:

C:/Workspace/product-files-v1/src/main/resources/input/products-2018112011001111.csv

when I would like to specify some kind of wildcard in the file path similar to this:

C:/Workspace/product-files-v1/src/main/resources/input/products-*.csv

but the above does not work.

What is the correct wildcard syntax and also is there a way to specify the relative file path instead of the absolute one as when I try to specify a relative file path I get an error too?

Error message in logs:

********************************************************************************
Message               : Illegal char <*> at index 108: C:/Workspace/product-files-v1/src/main/resources/input/products-*.csv.
Element               : product-files-v1/processors/1 @ product-files-v1:product-files-v1.xml:16 (Read File)
Element XML           : <file:read doc:name="Read File" doc:id="fdbbf477-e831-4e7c-827c-71efd1d2e538" config-ref="File_Config" path="C:/Workspace/product-files-v1/src/main/resources/input/products-*.csv" outputMimeType="application/csv" outputEncoding="UTF-8"></file:read>
Error type            : MULE:UNKNOWN
--------------------------------------------------------------------------------
Root Exception stack trace:
java.nio.file.InvalidPathException: Illegal char <*> at index 108: C:/Workspace/product-files-v1/src/main/resources/input/products-*.csv

Thanks for any help

1

1 Answers

1
votes

i am assuming you need to user a <file:matcher> when you want to filter or read certain type of files from a directory.

an example would be

<file:matcher
  filename-pattern="a?*.{htm,html,pdf}"
  path-pattern="a?*.{htm,html,pdf}"
/>