【发布时间】:2015-05-09 10:36:52
【问题描述】:
我在 spring 集成项目中使用ls 命令和递归模式定义了 ftp 出站适配器。我想过滤并获取指定sub-directories 中的文件。服务器上的目录结构是:
root
----------a\
---------------in\
---------------------a.op
----------b\
---------------in\
---------------------b.op
我想获取a.op 和b.op 文件。我将filename-regex 选项设置为([a-z]|in|.*\.op),但它不能正常工作,只过滤了第一级目录。我的适配器代码是:
<int:inbound-channel-adapter expression="'/'" channel="inbound">
<int:poller fixed-delay="20000"/>
</int:inbound-channel-adapter>
<int-ftp:outbound-gateway id="gatewayLS"
session-factory="ftpSessionFactory"
request-channel="inbound"
command="ls"
filename-regex="([a-z]|in|.*\.op)"
command-options="-R"
expression="payload"
reply-channel="toSplitter"/>
我该如何解决这个问题?
【问题讨论】:
-
尝试使用
\b([a-z]\\in\\.*?\.op)\b正则表达式。 -
感谢@stribizhev 的回复,但无法正常工作:(
-
这个
(in|.*.op)怎么样? -
使用
(.*\.op|^[^\.]+$)作为模式返回什么?
标签: spring ftp spring-integration