I'm using Apache Commons FTPClient to fetch files from FTP server. This is the setup:
ftpClient.setDefaultPort(port);
ftpClient.connect(server);
ftpClient.login(user, password);
ftpClient.enterLocalPassiveMode();
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
ftpClient.changeWorkingDirectory(path);
This is the transfer code:
final FileOutputStream fileOutputStream = new FileOutputStream(tempFile);
final boolean result = ftpClient.retrieveFile(dirToList + aFile.getName(), fileOutputStream);
Log.i(TAG, "[" + (result ? "+" : "-") + "]");
And what I see in the logs:
I/SyncService( 4412): /Users/user1/Downloads/FtpSync/.idea/copyrightprofiles_settings.xml
I/SyncService( 4412): [-]
<...>
I/SyncService( 4412): /Users/user1/Downloads/FtpSync/footer.php
I/SyncService( 4412): [+]
All php files are synced, and all xml files are failed to sync. The FTP server is on my local notebook (Mac OS X default ftp server, tnftpd 20100324+GSSAPI)
Why it does not work?
For first, you should always close the output stream after the retrieveFile method. Have you tried to change the FTP.{filetype} when downloading XML files (although this shouldnt be the case)?