Divs
Divs

Reputation: 1618

Spring Integration read files from dynamic multiple directories

I am using this and Spring forum. The process works if remote directory is set as "foo" but it doesn't accept expression (foo/\*/*) that can read any number of files/folders under "foo". Completely lost!

    @Bean
public FtpInboundFileSynchronizer ftpInboundFileSynchronizer() {
    FtpInboundFileSynchronizer fileSynchronizer = new FtpInboundFileSynchronizer(ftpSessionFactory());
    fileSynchronizer.setDeleteRemoteFiles(false);
    fileSynchronizer.setRemoteDirectoryExpression(new LiteralExpression("foo/*/*"));
    fileSynchronizer.setFilter(new FtpSimplePatternFileListFilter("*.txt"));
    return fileSynchronizer;
}

Is there a library that can provide programmatic control to deal with (s)ftp operations that work well with spring(-boot). The documentation is huge, and for a FTP beginner like me, I'm not getting anywhere soon.

Upvotes: 0

Views: 1368

Answers (1)

Gary Russell
Gary Russell

Reputation: 174504

You have to use an (S)FTP outbound gateway with a recursive MGET command for that. The inbound channel adapter (synchronizer) doesn't support pulling directory trees.

Upvotes: 1

Related Questions