You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sc <sc...@4info.com> on 2016/09/27 20:49:18 UTC

file2 include regex not reading files from ftpserver

I have  from defined as

<from
uri="sftp://****?password=****&amp;fastExistsCheck=true&amp;initialDelay=1000&amp;delay=500&amp;download=true&amp;noop=true
&amp;idempotent=true&amp;idempotentKey=${file:onlyname}&amp;idempotentRepository=#****
&amp;localWorkDirectory=/Users/**/temp/&amp;include=aaa_bbb_\d+_\d{10}\.zip"
/>

I have files on ftp server named as aaa_bbb_34_6366545717.zip, but its not
matching and reading the files.  The regex is correct as I compared it
against online tool with sample filenames.

Any help would be appreciated.

Thanks





--
View this message in context: http://camel.465427.n5.nabble.com/file2-include-regex-not-reading-files-from-ftpserver-tp5788129.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: file2 include regex not reading files from ftpserver

Posted by sc <sc...@4info.com>.
Used GenericFileFilter and it worked just fine.  Just adding it here incase
anyone wants to refer

public class AFilter implements GenericFileFilter {

	private String patternFormat;
	private Pattern pattern;
	private Matcher matcher;

	public AFilter(String patternFormat) {
		this.patternFormat = patternFormat;
		pattern = Pattern.compile(this.patternFormat);
	}

	public boolean accept(GenericFile pathname) {

		matcher = pattern.matcher(pathname.getFileName());
		return matcher.matches();
	}
}


<bean id="aFilter" class="AFilter">
<constructor-arg value="aaa_bbb_\d+_\d{10}\.zip" />
</bean>


<from
uri="sftp://****?password=****&amp;fastExistsCheck=true&amp;initialDelay=1000&amp;delay=500&amp;download=true&amp;noop=true 
&amp;idempotent=true&amp;idempotentKey=${file:onlyname}&amp;idempotentRepository=#**** 
&amp;localWorkDirectory=/Users/**/temp/&amp;filter=#aFilter" />




--
View this message in context: http://camel.465427.n5.nabble.com/file2-include-regex-not-reading-files-from-ftpserver-tp5788129p5788179.html
Sent from the Camel - Users mailing list archive at Nabble.com.