使用JSch在SFTP服务器上重命名文件时获取异常错误消息

时间:2016-11-08 10:49:24

标签: java sftp jsch

我正在尝试使用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)

0 个答案:

没有答案