我正在尝试使用JSch将文件从SFTP上的一个目录移动到另一个目录。我使用了重命名方法,但得到了以下异常(5:错误消息):
channelDes = session.openChannel("sftp");
channelDes.connect();
sftpChannelDes = (ChannelSftp) channelDes;
String sourcePath = "./abc/" + fileName;
String destinationPath = "./xyz/" + fileName;
sftpChannelDes.rename(sourcePath, destinationPath);
**Exception :-**
=================
5: Bad message
at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2846)
at com.jcraft.jsch.ChannelSftp.rename(ChannelSftp.java:1923)
at com.test.CopyFile.moveFile(CopyFile.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)