Hi,

I am writing a service to download files using Spring FTP.
The problem is i want to download file of the currentdate only. my file pattern would be file_yymmdd.csv, where yymmdd would be changing everyday.
I have written a filter service which implements FileListFilter<File>.
Code:
public class FileFilterTest implements FileListFilter<File>
{

	@Override
	public List<File> filterFiles(File[] files)
	{
		System.out.println("in FILTER FILES");
		List<File> currentFileList = new LinkedList<File>();
		
		for(File file:files)
		{
			/*if(file.getName().equals("files_120928.csv"));
			currentFileList.add(file);*/
			System.out.println("File --- "+file);
		}
		
		return currentFileList;
	}


}

My config is as follows:

Code:
	<int:channel id="ftpChannel">
		<int:queue />
	</int:channel>

	<int-ftp:inbound-channel-adapter id="ftpinbound"
		session-factory="ftpClientFactory" channel="ftpChannel"
		charset="UTF-8" 
		local-directory="/home/annuk/Downloads/inboundadapter/stores/"
		remote-directory="/Stores/"
		filter="fileFilter"
		>
		<int:poller fixed-rate="1000" />
	</int-ftp:inbound-channel-adapter>


	<bean id="ftpClientFactory"
		class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
		<property name="host" value="test" />
		<property name="port" value="21" />
		<property name="username" value="test" />
		<property name="password" value="testftp" />
	</bean>

	<bean id="fileFilter" class="com.ftp.filedownload.FileFilterTest" />
My javacode is as follows:

Code:
public static void main(String[] args)
	{
		System.out.println("in download test...");
		FileSystemXmlApplicationContext context = new FileSystemXmlApplicationContext(
				"/WebContent/WEB-INF/config/spring/ftp/ftp-download.xml");

		PollableChannel ftpChannel = context.getBean("ftpChannel", PollableChannel.class);
		System.out.println("ftpChannel " + ftpChannel);
		Message<List<?>> fileList = (Message<List<?>>) ftpChannel.receive();

		System.out.println("FileList is " + fileList);

		System.exit(0);

	}
The inbound adapter does not take the filter into consideration and downloads every file from the FTP. Where am I going wrong.
Is there any way by which we can close the FTP connection after the files are downloaded?

Please help.

Thanks in advance.
Regards,
Annuk