Home > Back-end >  The SFTP server files on moving to another directory?
The SFTP server files on moving to another directory?

Time:10-03

Bosses:

Now I want to do is, through the SFTP uploading files, when already exists on the server, the original server upload the files to a backup folder,

But, as if unable to get the server files and transmission, prompt can not find a file,

Otherwise can only be downloaded to the local first, then upload again to delete, but, downloaded to a local general download to what dish, C dish seems to have no jurisdiction,

Bosses have any experience in this field!

Thank you very much!

CodePudding user response:

Ls check the server directory
! The command execute commands, such as the mv

CodePudding user response:

Need to give you permission to operate server

CodePudding user response:

Java can be used JSCH SFTP operation, one of the methods: com. Jcraft. JSCH. ChannelSftp# rename
 public void rename (String oldpath, String newpath) 


Enter the old file full path the full path and new files, you can move the SFTP file, must ensure that there is a new path, does not exist, first build directory
Methods: com. Jcraft. JSCH. ChannelSftp# mkdir
 public void mkdir (String path) 


Maven add the following dependence can use,

Com. Jcraft
Jsch
0.1.54 & lt;/version>
  • Related