Announcement Announcement Module
Collapse
No announcement yet.
Automatically detect Files in Folders and save those files as documents in Mongodb Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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, 04:06 AM.

  • #2
    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" />

    Comment

    Working...
    X