Hi,

Got a chance to look into this again.

We still have the problem described, but just on a few destination servers
which all seems to be windows machines(?).

I have fetched the 2.4 branch of camel-ftp to find out why it does not work,
since the unit test you refer to in your previous post do excercise the
problem.

It appears that the cause of the problem is, that the
FtpOperations.existsFile fails to return true, which then causes the code
not to enter the part where it deletes the exisiting file.

The reason for the FtpOperations.existsFile to return false, is, that the
list of existing files has the directoryname prepended, e.g. I'm trying to
upload Test.REN to folder test/rename, and in the code 
"if (existing.equals(onlyName))" 
existing=test/rename\Test.REN and onlyName=Test.REN - which returns false -
but causes the later rename to fail as the target folder did contain the
Test.REN. 

My guess is that it is server dependent whether the returned list of names
in the directory include the directory name or not?

To fix this I have added the following line of code before the if-statement
existing = FileUtil.stripPath(FileUtil.normalizePath(existing));
So it will strip the path part of the file name before comparing it to
onlyName.

I've added a jira for this
(https://issues.apache.org/jira/browse/CAMEL-3595), including a patch.

Regards 
Mikael
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/Problem-renaming-existing-file-in-FTP-tp3307670p3359761.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to