title: Apache Camel zip folder
body: <p>I'm trying to zip a folder with Camel. I have a <code>Processor</code> that hass created folders with files inside them: </p>
  
  <pre><code>public class CreateDirProcessor implements Processor {
  
      public void process(Exchange exchange) throws Exception {
  
          Message in = exchange.getIn();
  
          File d = new File("myDir/hi");
  
          d.mkdirs();
  
          File f = new File(d, "hello.txt");
  
          f.createNewFile();
  
          in.setBody(f);
      }
  
  }
  </code></pre>
  
  <p>It works correctly.</p>
  
  <p>In my route, I try to zip the <code>hi</code> folder so I did this: </p>
  
  <pre><code>public static void main(String[] args) throws Exception {
      CamelContext context = new DefaultCamelContext();
  
      ProducerTemplate template = context.createProducerTemplate();
  
      context.addRoutes(new RouteBuilder() {
          public void configure() {
              from("direct:source")
              .process(new CreateDirProcessor())
              .marshal().zipFile().to("file:zipped");
          }
      });
  
      context.start();
  
      template.sendBody("direct:source", "test");
  
      Thread.sleep(3000);
  
      context.stop();
  
  }
  </code></pre>
  
  <p>And that does not work. I got: </p>
  
  <pre><code>TypeConversionException: Error during type conversion from type: java.io.File to the required type... `myDir/hi` is a directory
  </code></pre>
  
  <p>Is a directory not a file? Is it not possible to zip a whole folder and its contents with Camel?</p>
  
  <p>Thank you all. </p>