Topic "Synchronization issue - Can't overwrite file"

Author Message

I am scripting a local directory to remote sftp sync. The local source will be changing and the remote sftp destination should always mirror the source exactly.

option batch continue
option confirm off
open xxx
option transfer binary
synchronize remote \\xxx\yyy\zzz /aaa/bbb -mirror -nopermissions -delete

The sftp server is not allowing changed source files to overwritten as it's against our company policy. When the file sync tries to upload a changed file it fails and continues per the options I have set. If I change the batch option so that I'm prompted to "(D)elete the file", I can answer D obviously and the equivalent of an overwrite occurred, script continues.

A) In a put or synchronization operation, is there a way to tell WinSCP to delete a file before uploading a newer version? The overwrite is a 1 step operation to do this, but I need a 2 step delete then put as mandated by our company.
B) Alternatively, is there a way to tell the synchronize command to automatically answer D when prompted?

I am willing to run a beta copy if this functionality is not currently possible but a "2 step overwrite" or "automated prompt answer" switch can be added.

Thanks for your help everyone!
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26748
Location: Prague, Czechia
If you are using SFTP protocol, you can force transfer to temporary file name:

That basically does what you ask for.
Martin Prikryl

You can post new topics in this forum


What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License