This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error in rm method of J2SSH

 
Vishal Methi
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I have to remove files from SSH Server. I am using J2SSH.

I have written method to remove two files/directory from server. First directory is getting deleted successfully.
But deleting the 2nd directory i m getting the exception.

Below is my code and exception both.

Code :
public void removeFilesFromFTPServer (SftpClient sftp)
{
try {
sftp.rm("FBCHKBFHLLJEPIIMNJCP1231233677791"); // Running successfully
sftp.rm("MDCMAOCMAEBABMBHPHPL1231233677791"); // Here i m getting exception
}catch(IOException ioe)
{
ioe.printStackTrace();
}

Exception :

java.io.IOException: Failure
at com.sshtools.j2ssh.sftp.SftpSubsystemClient.getOKRequestStatus(Unknown Source)
at com.sshtools.j2ssh.sftp.SftpSubsystemClient.removeDirectory(Unknown Source)
at com.sshtools.j2ssh.SftpClient.rm(Unknown Source)

Could you please help me what may be the reason.

Thanks in advance.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you look at the docs? Does the directory have to be empty for "rm" to remove it? Is it empty?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic