I tried googling everywhere, but cannot find anywhere. I am trying to accomplish is to go to SFTP or SSH and delete/remove the directory.
here is my code. any help is appreciated. this code does not delete and remove the directory as it suppose to do it.
public static boolean removeDirectory(String path, Session session) throws InterruptedException {
ChannelExec channelExec = null;
try {
channelExec = (ChannelExec) session.openChannel("exec");
String command = "rm -rf "+path;
channelExec.setCommand(command);
channelExec.connect();
Thread.sleep(5000);
channelExec.disconnect();
} catch (JSchException e1) {
return false;
}
return true;
}