I have a program, which copies data from a ISERIES ftp server to my local folder c:\ temp. On this ftp server I have pdf files, doc files and txt files
The transfer to my local drive is working fine and all files appearing as expected.
Same program is picking up the data from my local drive and should copy same things to another FTP server.
This process is also working....but....
the TXT files have no content on my target FTP server and arriving with 0 kilo bytes, although they have contents on the source ftp server
and on the local c:\temp drive ?! The pdf and doc files are transferred correctly to the target ftp server.
Can anybody help and explain, why only TXT files have no content and arriving with 0 kilo bytes ?
While FTP has separate binary and text transfer modes, this just covers translations of certain things, particularly newlines. However, there's nothing that I know of that would prevent a text file from being transferred in binary mode. It's not like FTP is going to analyze the bytes, realize they're text, not binary, and refuse to transfer them. I've never used the FTP class you're using though, so I don't know its quirks. You might try transferring the same files in binary, passive mode via the command line FTP client, and to the same destination machine and directory. Does that work?
have tested with ftp clients in binary mode and it is working.
The download to my local drive is ok, as I said. It is just,
when store() files back from local to FTP.
Same happens when I am doing it directly from FTP => FTP.
(I am using commons-net-3.0) to store the files to the FTP server
Well, I figured there must be something different about those files other them just being text files. Still, I don't really get why the buffer size makes a difference, unless a buffer isn't getting flushed somewhere. Even so, reducing the buffer size could lessen the problem, but probably not eliminate it. Maybe it's a matter of making the buffer size match between the FTP and the BufferedInputStream. I'm not sure why that would be though. Anyway, I'm glad you solved the problem!