Move the directory on the remote server to another location on the same remote server using jsch

I am using the API API to connect to a remote server via sftp. I need to move the directory present on the remote server from location A to location B. It seems that the channelsftp.put (src, dest) method only allows moving the file, not the directory.

Can someone explain to me how to do this?

+4
source share
1 answer

You can use the rename command, it will move the file or directory and delete it from its original location.

sftpChannel.rename (oldFile, newFile);

Do not use this method if you want to keep the original directory / file.

Hope this helps.

+12
source

Source: https://habr.com/ru/post/1444650/


All Articles