We need to rename the file after the SFTP transfer. The transfer itself runs successfully. But renaming fails.
Actually all the commands we tried fail:
We tried the following commands:
'rename f1 f2'
'ls'
'cd <dir>'.
We use: com.enterprisedt.net.ftp.SecureFileTransferClient
The log :
==============================
17:07:56,417 PROTOCOL: SFTP
17:07:56,418 REMOTE_PORT: 22
17:07:56,418 setServerValidationStatus
17:07:56,418 SERVER VALIDATION ENABLED: false
17:07:56,418 setConnectMode
17:07:56,418 CONNECT_MODE:Passive
17:07:56,418 Connecting to server ....
17:07:57,595 Connected to server !
17:07:57,595 setTransferType
17:07:57,595 TRANSFER_TYPE:Binary
17:07:57,595 Local File: /local/home/file1
17:07:57,595 Remote File: /file2
17:07:59,097 Remote size == Local size (499)
17:07:59,097
17:07:59,098 Execute Command: rename f2 f2.test
17:07:59,405 Failed to execute command 'rename f2 f2.test'
com.enterprisedt.net.ftp.FTPException: Failed to execute command 'rename f2 f2.test'
at com.enterprisedt.net.ftp.ssh.SCPClient.executeCommand(SCPClient.java:1030)
at com.enterprisedt.net.ftp.async.internal.ExecuteCommandTask.run(ExecuteCommandTask.java:89)
at com.enterprisedt.net.ftp.async.internal.FTPTaskProcessor$b.run(FTPTaskProcessor.java:590)
Exception in thread "main" UploadException: MultiFTPUploadProcessor: Exception:
at MultiFTPUploadProcessor.process(MultiFTPUploadProcessor.java:129)
at MultiFTPUploadProcessor.main(MultiFTPUploadProcessor.java:1024)
17:07:59,925 Processed systems: [5306]
Caused by: UploadException: com.enterprisedt.net.ftp.FTPException: Failed to execute command 'rename f2 f2.test'
at MultiFTPUploadProcessor.sendOther(MultiFTPUploadProcessor.java:467)
at MultiFTPUploadProcessor.send(MultiFTPUploadProcessor.java:313)
at MultiFTPUploadProcessor.process(MultiFTPUploadProcessor.java:96)
... 1 more
Caused by: com.enterprisedt.net.ftp.FTPException: Failed to execute command 'rename f2 f2.test'
at com.enterprisedt.net.ftp.ssh.SCPClient.executeCommand(SCPClient.java:1030)
at com.enterprisedt.net.ftp.async.internal.ExecuteCommandTask.run(ExecuteCommandTask.java:89)
at com.enterprisedt.net.ftp.async.internal.FTPTaskProcessor$b.run(FTPTaskProcessor.java:590)
===============================
The connection is done like this:
SecureFileTransferClient connectOther()
{
SecureFileTransferClient ftpClient = new SecureFileTransferClient();
ftpClient.setRemoteHost(host);
ftpClient.setUserName(user);
ftpClient.setPassword(psw);
setProtocol(ftpClient,'sftp');
setServerValidationStatus(false);
//CONNECT MODE
setConnectMode(Passive);
//CONNECT !!!
log.info("Connecting to server " + ftpClient.getRemoteHost());
ftpClient.connect();
log.info("Connected to server " + ftpClient.getRemoteHost());
//TRANSFER TYPE
setTransferType(BINARY);
return ftpClient;
}
Thank you for your help in advance.
Greg.