setting File transfer mode in SFTP using JSch (jsch-20070302.jar)
807589Dec 10 2007 — edited Jan 16 2009Hi,
I use Jsch for downloading and uploading files via SFTP. I am a facing a problem in the file transfer mode. When I download or upload manually the files seems file, but when I use my code to download or upload there is some problem. Actally the file has to be transferred in ASCII mode, but the code transfers it in binary mode. Below is the code I am using
+import com.jcraft.jsch.*
Session session = null;
try {
populateProperties();
log("INFO","Download and Encrypt Program started",getDateTime());
JSch jsch = new JSch();
String host = tumbleweedURL;
String user = tUserid;
session = jsch.getSession(user, host, 22);
session.setUserInfo(new MyUserInfo());
session.setPassword(tPassword);
session.connect();
Channel channel = session.openChannel("sftp");
channel.connect();
ChannelSftp c = (ChannelSftp) channel;
c.cd("outbox");
c.get("8",outFolderPath);
}+
Please tell me how I change the transfer mode to ASCII for the above code