Jsch how to list files along with directories
- by Rajeev
In the following code when the command ls -a is executed why is that i see only the list of directories and not any files that are on a remote linux server
JSch jsch = new JSch();
Session session = jsch.getSession(username1, ip1, 22);
java.util.Properties config = new java.util.Properties();
config.put("StrictHostKeyChecking", "no");
session.setConfig(config);
//session.setPassword(password.getText().toString());
session.setPassword(password1);
session.connect();
final ListView mainlist = (ListView)findViewById(R.id.list);
final RelativeLayout rl = (RelativeLayout)findViewById(R.id.rl);
mainlist.setVisibility(View.VISIBLE);
rl.setVisibility(View.INVISIBLE);
String command = "ls -a";
Channel channel = session.openChannel("exec");
((ChannelExec) channel).setCommand(command);
channel.setInputStream(null);
((ChannelExec) channel).setErrStream(System.err);
InputStream in = channel.getInputStream();