Discuss (FTP) and (SFTP, FTPS and SCP), our Java file transfer clients.
no avatar
User

ashosheh

Posts

7

Joined

Thu Jan 13, 2011 7:31 pm

Location

JO

Carriage return in text files

by ashosheh » Mon Sep 09, 2013 6:10 pm

Hello,

We have the following problem when using SSHFTPClient.get in BINARY MODE.
The source file is transferred from unix box which has CL carriage return, when the file is transferred to a windows machine, all carriage returns are changed to windows CRLF.
This will cause the transferred file size to increase.

sshFtp.setType(FTPTransferType.BINARY);

Thanks,
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: Carriage return in text files

by support2 » Mon Sep 09, 2013 8:07 pm

In binary mode, the file is transferred byte for byte, so it should be identical.
no avatar
User

ashosheh

Posts

7

Joined

Thu Jan 13, 2011 7:31 pm

Location

JO

by ashosheh » Mon Sep 09, 2013 8:54 pm

Thanks for the reply...
We are using BINARY mode. is there anything else we can check in the code?
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Mon Sep 09, 2013 9:37 pm

For starters please post the code you are using (and the version).
no avatar
User

ashosheh

Posts

7

Joined

Thu Jan 13, 2011 7:31 pm

Location

JO

by ashosheh » Mon Sep 09, 2013 9:50 pm

We have Version: 4.5.0
---------------------------
SSHFTPClient sshFtp = new SSHFTPClient();
sshFtp.getValidator().setHostValidationEnabled(false);
sshFtp.setRemoteHost(serverAddress);
sshFtp.setAuthentication(userName, password);
sshFtp.setType(FTPTransferType.BINARY);
sshFtp.connect();
sshFtp.chdir(remotePath);
sshFtp.setType(FTPTransferType.BINARY);
File localfile = new File(localPath, fileName);

System.out.println(sshFtp.getType()); //--> This line prints BINARY

sshFtp.get(localPath, fileName);
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Mon Sep 09, 2013 9:57 pm

Looks ok. Enable logging at DEBUG level and send us the zipped log file (support at enterprisedt dot com)
no avatar
User

ashosheh

Posts

7

Joined

Thu Jan 13, 2011 7:31 pm

Location

JO

by ashosheh » Mon Sep 09, 2013 10:19 pm

log file is sent
no avatar
User

ashosheh

Posts

7

Joined

Thu Jan 13, 2011 7:31 pm

Location

JO

by ashosheh » Mon Sep 09, 2013 10:44 pm

Worked after setting sshFtp.setDetectTransferMode(false);
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Tue Sep 10, 2013 7:10 am

Well spotted - yes this feature can occasionally trip people up.

Who is online

Users browsing this forum: No registered users and 16 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign
cron