You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by swwyatt <st...@sungard.com> on 2011/02/16 22:57:59 UTC
File component move option
I have configured a route with a file consumer like the one below:
my.properties:
MY_PATH=c\:\\\\temp\\import
MY_SAVE_PATH=c\:\\\\temp\\import\\save
<camel:from
uri="file:{{MY_PATH}}?recursive=true&move={{MY_SAVE_PATH}}/${file:name}"></camel:from>
On the disk I have a file:
c:\\temp\import\a\01\1.xml
I expected the file to be moved to:
c:\\temp\import\save\a\01\1.xml
I got the exception:
15:33:37 ERROR [pdvwimport] GenericFileOnCompletion - Caused by:
[org.apache.camel.component.file.GenericFileOperationFailedException -
Cannot create directory: c:\temp\import\save\c:\temp\import\a\01 (could be
because of denied permissions)]
Is this the correct behavior? From the File component/File language
documentation, using 'file:name' should refer to a file named 'a\01\1.xml'
in either relative or absolute cases, but results are otherwise.
--
View this message in context: http://camel.465427.n5.nabble.com/File-component-move-option-tp3388470p3388470.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: File component move option
Posted by Ashwin Karpe <ak...@fusesource.com>.
Hi,
Why do you use backslashes in your file URI.
A proper file URI scheme requires forward slashes aka UNIX
http://en.wikipedia.org/wiki/File_URI_scheme
http://en.wikipedia.org/wiki/File_URI_scheme
I believe this is at the root of your issue. File URIs on windows also use
forward slashes. Please check the blog entry below.
http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx
http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx
Please change your my.properties settings to:
MY_PATH=c:/temp/import
MY_SAVE_PATH=c:/temp/save
Cheers,
Ashwin...
-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com http://fusesource.com
Blog: http://opensourceknowledge.blogspot.com
http://opensourceknowledge.blogspot.com
---------------------------------------------------------
--
View this message in context: http://camel.465427.n5.nabble.com/File-component-move-option-tp3388470p3388780.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: File component move option
Posted by stanleyab <st...@acslink.net.au>.
I came across this error while running Camel 2.17.0 with Spring 4.3.7.
One of our unit tests had the file move syntax given in the example in the
Camel documentation of the File component:
move=backup/${date:now:yyyyMMdd}/${file:name}
and produced that error.
What seems to have happened is that Spring saw the "${" construct and went
to do a property substitution. It then passed the resulting string
move=backup/date:now:yyyyMMdd/file:name
to Camel which passed it to Java and threw and IO error because the ":x:" is
an illegal sequence in file paths. I changed the syntax to
move=backup/$simple{date:now:yyyyMMdd}/$simple{file:name}
and it started working!
Other unit tests had something similar, with
{{archive.dir}}
being a property
archive.dir=archive/${date:now:yyyyMMdd}/
and failed with the same error. When I changed the properties files to use
archive.dir=archive/$simple{date:now:yyyyMMdd}/
they started working.
--
View this message in context: http://camel.465427.n5.nabble.com/File-component-move-option-tp3388470p5810399.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: File component move option
Posted by Claus Ibsen <cl...@gmail.com>.
We have fixed an issue with the starting paths being absolute in the
file component.
http://camel.apache.org/camel-270-release.html
That fix will make into Camel 2.7.
On Wed, Feb 16, 2011 at 10:57 PM, swwyatt <st...@sungard.com> wrote:
>
> I have configured a route with a file consumer like the one below:
>
> my.properties:
> MY_PATH=c\:\\\\temp\\import
> MY_SAVE_PATH=c\:\\\\temp\\import\\save
>
> <camel:from
> uri="file:{{MY_PATH}}?recursive=true&move={{MY_SAVE_PATH}}/${file:name}"></camel:from>
>
> On the disk I have a file:
>
> c:\\temp\import\a\01\1.xml
>
> I expected the file to be moved to:
>
> c:\\temp\import\save\a\01\1.xml
>
> I got the exception:
>
> 15:33:37 ERROR [pdvwimport] GenericFileOnCompletion - Caused by:
> [org.apache.camel.component.file.GenericFileOperationFailedException -
> Cannot create directory: c:\temp\import\save\c:\temp\import\a\01 (could be
> because of denied permissions)]
>
> Is this the correct behavior? From the File component/File language
> documentation, using 'file:name' should refer to a file named 'a\01\1.xml'
> in either relative or absolute cases, but results are otherwise.
> --
> View this message in context: http://camel.465427.n5.nabble.com/File-component-move-option-tp3388470p3388470.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/