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 serverCodePudding user response:
Java can be used JSCH SFTP operation, one of the methods: com. Jcraft. JSCH. ChannelSftp# renamepublic 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,