This is by design the file component is for consuming *files*, not directories.
On Wed, Aug 6, 2014 at 10:58 AM, jkir <james.kirr...@baesystems.com> wrote: > Unfortunately, after digging through the source code for the FileConsumer, it > seems that although most of the framework is there for matching the > directories themselves, there appears to be one area preventing it from > adding the directory itself to the files list for further processing. > > Taken from > https://github.com/apache/camel/blob/e7563a7611667fb9b449d8a7f8c3fa7e3a0524bd/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java: > > if (file.isDirectory()) { > if (endpoint.isRecursive() && depth < endpoint.getMaxDepth() > && isValidFile(gf, true, files)) { > // recursive scan and add the sub files and folders > String subDirectory = fileName + File.separator + > file.getName(); > boolean canPollMore = pollDirectory(subDirectory, > fileList, depth); > if (!canPollMore) { > return false; > } > } > } else { > // Windows can report false to a file on a share so regard > it always as a file (if its not a directory) > if (depth >= endpoint.minDepth && isValidFile(gf, false, > files)) { > log.trace("Adding valid file: {}", file); > // matched file so add > fileList.add(gf); > } > > } > > Notice that the fileList is only added to if the file is NOT a directory. I > think if fileList.add(gf); is added to the third line above, this will solve > my problem, however it is not yet supported. I wonder if this is deliberate > behaviour or if should be raised as a bug... > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Polling-a-directory-for-inner-directories-tp5754812p5754831.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/