Results 1 to 2 of 2

Thread: Automatically detect Files in Folders and save those files as documents in Mongodb

  1. #1
    Join Date
    Oct 2012
    Posts
    1

    Default Automatically detect Files in Folders and save those files as documents in Mongodb

    Hi,
    We have a requirement where in, in one main folder we will have many sub folders and in that sub folder i will have a file. My question is can we use spring integration to traverse these sub folders periodically say every 10 minutes, pick up the file automatically and save those files into mongodb as documents/gridfs.
    Any help is appreciated immensely.

    Thanks in advance,
    kensuser
    Last edited by kensuser; Oct 31st, 2012 at 03:06 AM.

  2. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,040

    Default

    You can use a RecursiveLeafOnlyDirectoryScanner but note the comment in its JavaDoc - it's not suitable for very large directory trees.

    Code:
    <int-file:inbound-channel-adapter id="filesIn"
                  scanner="recursiveScanner"
                  directory="file:${java.io.tmpdir}/spring-integration-samples/input"
                  filename-pattern="*.txt"> 
        <int:poller fixed-delay="600000" />
    </file:inbound-channel-adapter>
    
    <bean id="recursiveScanner" class="org.springframework.integration.file.RecursiveLeafOnlyDirectoryScanner" />
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •