How to get File Name without extension in Camel


Hi Does anyone know how to get a file name without extension in camel. using spring xml.

I know ${header.CamelFileNameOnly} will give the full file name like "test.txt".

I would just like to get the name "test" and need to use this name in somewhere else, does anyone know how to do it ?

Best Solution

Use the file-expression language. Your route shall be something like

    <camel:from uri="file://input/orders" />
    <camel:setHeader headerName="FileNameWithoutExtension">
Related Question