I'm trying to check the existance of a file in an FTP server using Spring Integration but it doesn't seem to work. It works fine with directories but not with files. In documentation is mentioned that works with directories and files. Am I building the path correctly?
private DefaultFtpSessionFactory getFTPFactory() {
DefaultFtpSessionFactory defaultFtpSessionFactory = new DefaultFtpSessionFactory();
defaultFtpSessionFactory.setHost("localhost");
defaultFtpSessionFactory.setPort(21);
defaultFtpSessionFactory.setUsername("foo");
defaultFtpSessionFactory.setPassword("pass");
return defaultFtpSessionFactory;
}
public boolean getFTPFiles() throws IOException {
DefaultFtpSessionFactory defaultFtpSessionFactory = getFTPFactory();
FtpSession ftpSession = defaultFtpSessionFactory.getSession();
FTPClient clientInstance = ftpSession.getClientInstance();
clientInstance.enterLocalPassiveMode();
return ftpSession.exists("/ftp/foo/study/download/test_1.txt");
}