java - Apache VFS SFTP moveTo command fails -
I am using Apache vfs sftp to copy a file into a remote Linux box and then rename it. The copy works fine, but when I try to rename the file, it fails I am using vfs 2.0 and jsch 0.1.50
source (remote filetep) /tmp/abc.txt Destination (RemoteFileDist): /home/myName/work/abc.txt The command I used is below:
remoteFileTmp.moveTo (remote file delete); The exception I get is below:
Exception in thread "main" java.lang RuntimeException : Org.apache.commons.vfs2.FileSystemException: To: "//hostname/tmp/abc.txt SFTP" "Could not rename" SFTP: //hostname/home/myName/work/abc.txt ". Due on com.transfer.SFTPTransfer.uploadRename com.transfer.MainClass.main (SFTPTransfer.java:85) (MainClass.java:23): org.apache.commons.vfs2.FileSystemException: The name could not be changed "SFTP : / /hostname/tmp/abc.txt "from" sftp: //hostname/tmp/abc.txt "to" sftp: //hostname/home/myName/work/abc.txt " Failure to com: 4: On org.apache.commons.vfs2.provider.AbstractFileObject.moveTo (AbstractFileObject.java:1116) on com.transfer.SFTPTransfer.uploadRename (SFTPTransfer.java:59) ... 1 more because of . jcraft.jsch.ChannelSftp.throwStatusError com.jcraft.jsch.ChannelSftp.rename (ChannelSftp.java:1910) on org.apache.commons.vfs2.provider.sftp.SftpFileObject.doRename (ChannelSftp.java:2833) (SftpFileObject. Java: 289) on org.apache.commons.vfs2.provider.AbstractFileObject.moveTo (AbstractFileObject.java:1102) ... 2 more the directory / home / myName / work exists
Note: When I try to move to the same folder i.e. is the succesfful to change the input name below.
source = /tmp/abc.txt Destination = /tmp/abc.txt_renamed Similar is it only supports rename in that directory is?
This Apache VFS library runs on SFTP: - (
and this
Comments
Post a Comment