Hi
All the file name from the simple language is headers on the message.
So they are already there.
The only name is the header with this key: Exchange.FILE_NAME_ONLY
So you can copy it to a foo header as follows:
.setHeader("foo", header(Exchange.FILE_NAME_ONLY))
On Wed, Mar 14, 2012 at 5:24 PM, chrislovecnm <[email protected]> wrote:
> How do I access the file name? I have tried accessing the headers which gets
> me ${file:nameonly} but not the file name itself. How do I evaluate this?
>
> Here is my route:
>
>
> from("file:///u01/www/images/nonprofits-test?move=.done&preMove=.processing&filter=#nonpFileFilter&minDepth=2&recursive=true")
>
> from("file:///u01/www/images/nonprofits-test?move=.done&preMove=.processing&filter=#nonpFileFilter&minDepth=2&recursive=true")
> .setHeader("test-this",
> simple("\${file:onlyname}"))
> .setHeader("test-this-again",
> constant("\${file:onlyname}"))
> .setHeader("test-this-again2",
> simple(CamelConstants.CAMEL_FILE_NAME))
> .setHeader("test-this-again3",
> simple(CamelConstants.CAMEL_FILE_NAME_ONLY))
>
>
> This is coded in grails / groovy so the \${file:name} should be evaluated to
> ${file:name}, but all I get is ${file:nameonly}. I also have the string in
> java code, just in-case running it in groovy is playing havoc.
>
> Thanks in advance
>
> Chris
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/File-endpoint-getting-actual-filename-file-nameonly-tp5565342p5565342.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
FuseSource
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/