thanks for attention, i defined
int-ftp:outbound-gateway adapter with ls command in my spring integration project, i want to filter recursively
.op extension files that in my ftp directories and i set
*.op nut not worked, my code is:
Update: thanks for help @Gary, i used
filename-regex option Instead of
([foo]|.*\.op) (for example) and it's work.
For filter multiple subDirectory we can use regular expression
([a-z]*|[a-z]*|.*\.op) and it's work correctly.
Best How To :
The problem is likely that your subdirectories don't pass the filter and hence are not searched. As described in the documentation, you need to add the subdirectory pattern to your filter...
... However, files in the tree can be filtered, by providing a FileListFilter; directories in the tree can also be filtered this way. A FileListFilter can be provided by reference or by filename-pattern or filename-regex attributes. For example,
filename-regex="(subDir|.*1.txt)" will retrieve all files ending with 1.txt in the remote directory and the subdirectory subDir. If a subdirectory is filtered, no additional traversal of that subdirectory is performed.
So, if you have, say subdirs
foo3 etc., you can use
The first part of the regex passes the subdirs, the second matches files (or directories) ending
It is important to understand how the recursion works. Starting at the top level...
- list files/dirs
- filter files/dirs
- iterate, if a directory, recurse
You can, of course, supply a custom filter to work whatever way you want (e.g. don't filter directories).