spring - file-pattern option in int-ftp:outboundgateway not work in recursive mode? -
thanks attention, defined int-ftp:outbound-gateway
adapter ls command in spring integration project, want filter recursively .op
extension files in ftp directories , set file-pattern
*.op
nut not worked, code is:
<int-ftp:outbound-gateway id="gatewayls" session-factory="ftpsessionfactory" request-channel="inbound" command="ls" filter="ftpfilter" filename-pattern="*.op" remote-directory="" command-options="-r" expression="payload" reply-channel="tosplitter"/>
update: @gary, used filename-regex
option instead of filename-pattern
([foo]|.*\.op)
(for example) , it's work.
filter multiple subdirectory can use regular expression ([a-z]*|[a-z]*|.*\.op)
, it's work correctly.
the problem subdirectories don't pass filter , hence not searched. described in the documentation, need add subdirectory pattern filter...
... however, files in tree can filtered, providing filelistfilter; directories in tree can filtered way. filelistfilter can provided reference or filename-pattern or filename-regex attributes. example,
filename-regex="(subdir|.*1.txt)"
retrieve files ending 1.txt in remote directory , subdirectory subdir. if subdirectory filtered, no additional traversal of subdirectory performed.
so, if have, subdirs foo1
, foo2
, foo3
etc., can use
filename-regex="(foo[0-9]|.*\.txt)"
the first part of regex passes subdirs, second matches files (or directories) ending .txt
.
it important understand how recursion works. starting @ top level...
- list files/dirs
- filter files/dirs
- iterate, if directory, recurse
you can, of course, supply custom filter work whatever way want (e.g. don't filter directories).
Comments
Post a Comment