I want to download files which are in subfolder on FTP server but I see that my client can't access subfolders.
I wrote simple code to list all files in subfolder:
public static void main(String[] args) throws IOException {
FTPClient ftpClient = new FTPClient();
ftpClient.connect(HOST, PORT);
ftpClient.login(USER, PASS);
ftpClient.enterLocalPassiveMode();
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
FTPFile[] files = ftpClient.listFiles("/archive");
int length = files.length;
System.out.println("Number of files: " + length);
ftpClient.logout();
ftpClient.disconnect();
}
But length of files array is zero.
When I run this program on main directory files are listed properly.