You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Mikael Andersson Wigander <mi...@pm.me.INVALID> on 2021/03/26 15:31:54 UTC

How to preserve paths when using ZipAggregation?

Hi

I'm building a archive solution for files and using the Zip dataformat and aggregation.
Trying with the option "preservePathElements=true" but the ZIP file doesn't include any paths for my files.
My purpose here is to be able to detect from where in the directory structure the files comes from.

My code is similar to the sample

from("file:input/directory?antInclude=**/*.txt&recursive=true") .aggregate(constant(true), new ZipAggregationStrategy()) .completionFromBatchConsumer().eagerCheckCompletion() .to("file:output/directory");

and the only way to add the option is thru the properties file:
camel.dataformat.zipfile.preserve-path-elements = true

Pls advice

/M

Re: How to preserve paths when using ZipAggregation?

Posted by Mikael Andersson Wigander <mi...@pm.me.INVALID>.
Answering my own question…

By adding true to the ZipAggregationStrategy constructor, filenames are preserved.


/M

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Friday, March 26th, 2021 at 16:31, Mikael Andersson Wigander <mi...@pm.me.INVALID> wrote:

> Hi
>
> I'm building a archive solution for files and using the Zip dataformat and aggregation.
>
> Trying with the option "preservePathElements=true" but the ZIP file doesn't include any paths for my files.
>
> My purpose here is to be able to detect from where in the directory structure the files comes from.
>
> My code is similar to the sample
>
> from("file:input/directory?antInclude=**/*.txt&recursive=true") .aggregate(constant(true), new ZipAggregationStrategy()) .completionFromBatchConsumer().eagerCheckCompletion() .to("file:output/directory");
>
> and the only way to add the option is thru the properties file:
>
> camel.dataformat.zipfile.preserve-path-elements = true
>
> Pls advice
>
> /M