mj596
mj596

Reputation: 1

apache-camel file component recursive and tempFileName

I have the following problem: I would like to use ftp component to read and then write files along with paths relative to ftp user home directory. For that I use recursive=true in spring and it works fine. The problem is that I also need to use tempFileName but in the target location *tmp files created as ${file:onlyname.noext}.tmp cannot be stored in the target directory but in home direcotry i.e. when source is:

A
|-> B
|-> C
    |->file.txt

the target should be:

A
|->file.tmp (temporary)
|-> C
    |->file.txt (file.tmp cannot be stored here!)

However, tempFileName seems to be only working relative to full path. Can this be changed?

Upvotes: 0

Views: 2415

Answers (2)

Erik Karlstrand
Erik Karlstrand

Reputation: 1527

Since the .tmp suffix was not a requirement I suggest looking at the tempPrefix-option.

<to uri="file:///C?tempPrefix="../" />

This would then lead to your file being stored in directory A with the name file.txt until the whole file has been completely written, then it will be moved to the final destination of directory C.

Upvotes: 0

Claus Ibsen
Claus Ibsen

Reputation: 55750

You cannot do this today, but we have an improvement so you will be able to do this in Camel 2.18.2 onwards. Then you can use ../${file:onlyname.noext}.tmp as the temporary file name.

This was logged in ticket: https://issues.apache.org/jira/browse/CAMEL-10737

Upvotes: 1

Related Questions