SynchronizeDirectories fails with "Item with the same name already exists"

Advertisement

mtmuser
Joined:
Posts:
4
Location:
US

SynchronizeDirectories fails with "Item with the same name already exists"

I am using WinSCPnet library version 1.7.2.10640 to perform a Session.SynchronizeDirectories via C# to Box. My app is failing at different points (meaning never on the same file or directory) due to the following:
WinSCP.SessionRemoteException: Error transferring file 'C:\Users\myuser\Documents\filetosave_files\Folder_1\Any_Subfolder\AnyFile-Filename.FilesExtension'.
Copying files to remote side failed.
Box: Item with the same name already exists (code=item_name_in_use, request_id=3pxua5gn1nlck6eu).
Note: references to Any_Subfolder\AnyFile-Filename.FilesExtension in the above mean the error has occurred on just about any file in any subfolder
The code being executed is:
string localPath = @"C:\Users\myuser\Documents\filetosave_files\Folder_1";
string remotePath = "/MyTargetFiles/MyTestSync/Folder_1";
session.Open(sessionOptions);
TransferOptions transOpts = new TransferOptions();
transOpts.FileMask = "| @Rec*; .DS_Store";
SynchronizationResult syncResult = session.SynchronizeDirectories(SynchronizationMode.Remote, localPath, remotePath, removeFiles: false, options: transOpts);
Do I need to increase a timeout value? If yes, how is that done via the WinSCPnet library? I have tried setting ResumeSupport to On, but that didn't help.

Please note: When I execute the same transfer from the WinSCP UI, I get the same error. Sometimes after the connection times out then reconnects. Sometimes seemingly of its own accord. If I click "Retry", the process moves on but can fail again with "Copying files to remote side failed.","Box: Partial-file uploads are not supported."

I am attaching a log file.

Thanks!

Reply with quote

Advertisement

mtmuser
Joined:
Posts:
4
Location:
US

Re: SynchronizeDirectories fails with "Item with the same name already exists"

I've set the "Server response timeout" to 60 seconds in the UI. Perhaps that is a little overkill, but I can dial it back later if it can be set in dotNet. When I executed the same copy via the UI, I did get one response message "Copying files to remote side failed.". I clicked Retry and, after a minute or so, the process moved on and finished successfully with no further errors or messages. I executed the same upload a second time (after removing the files from the remote directory) with the same settings and didn't get any errors. I think we're onto something here.
Is there a way to set the Server response timeout for execution of Session.SynchronizeDirectories, and also to set Retry to automatic (not sure if that is the default). If these things can be done, please point me to the doc pages and I will continue my testing.
UPDATE:
I found the Timeout setting for SessionOptions (sorry, I thought that was for the initial log in process exclusively). I've set that to 60 seconds and have gotten two clean uploads - each using the same files/paths as my previous tests. I will continue to expand my testing from here.
Are there any other settings you can recommend to make my app more resilient? Any retry options; etc. that I should examine?

Reply with quote

martin
Site Admin
martin avatar

Re: SynchronizeDirectories fails with "Item with the same name already exists"

I do not have any other recommendation atm. Let me know if you have any problems.

Reply with quote

mtmuser

Re: SynchronizeDirectories fails with "Item with the same name already exists"

One last, quick (I hope) question:
For TransferOptions.FileMask, when using SynchronizeDirectories, will ">=<date>" be ignored?

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum