I made a function to download a file or a folder, I was trying to use ftpconnection.getFilesInfos() but i noticed that it some times returns an array with the correct length and some times returnes null, it returns null if the folder name was too long and it wasn't the working directory like saying ftpconnection.getFilesInfos("/folder1/folder2/very loooooooong name");.
To go around it i changed the working directory to this folder
ftpconnection.changeWorkingDirectory("/folder1/folder2/very loooooooong name");
FTPFile[] ff = ftpconnection.getFilesInfos();
now it works fine
Thanks