Topic "Questions about synchronize [rename & delete]"

Author Message
IaMa8oY
[View user's profile]

Joined: 2016-06-28
Posts: 1
Location: Sydney
Hi

the SFTP server is on remote VPS, winscp app is at local
I am trying to synchronize multiple files and directories at local c:\local\ and remote /D/remote/, both windows OS.
**Both sides {local or remote} may create/delete/edit/rename files or directories at any time**


Existing Folder Structures:
Code:

C:\local\                             /D/remote/
        \File_1.txt                            /File_1.txt
        \File_2.txt                            /File_2.txt
        \Folder_A\                             /Folder_A/ 
        \Folder_A\File_A1.txt                  /Folder_A/File_A1.txt         
        \Folder_A\File_A2.txt                  /Folder_A/File_A2.txt             
        \Folder_B\File_B1.txt                  /Folder_B/File_B1.txt     
        \Folder_B\File_B2.txt                  /Folder_B/File_B2.txt       


Synchronize Code:
Code:

option batch abort
option confirm off
open sftp://user:pass@ip:port -hostkey="ecdsa-sha2-nistp384 384 c8:53:70:a4:1b:79:8b:10:0c:5e:9b:45:95:76:33:be"
synchronize both C:\local\ /D/remote/
exit


Create and Edit works without issue.
Create:
When I create files and folders on both sides, it syncs to the other side. So create is all good with the above code.

Edit:
When I edit something in File_B2.txt on both sides, it syncs to the other side. So Edit is all good with the above code.


Delete and rename doesn't work as expected.
Delete:
When I delete files and folders on both sides, it wont delete on the other side.
eg: Steps
.......1) delete folder C:\local\Folder_B
.......2) run the above synchronize Code
it will
.......1) download Folder_B from remote to local

Code: synchronize -delete remote C:\local\ /D/remote/ will work with the above situation.
But it fails if user delete files or folders on remote server first.

Rename:
When I rename files and folders on both sides, it wont rename on the other side.
eg:Steps:
.......1) rename File_1.txt to File_3.txt at Local C:\local\ folder.
.......2) run the above synchronize Code
it will
.......1) download File_1.txt from remote to local
.......2) upload File_3.txt from local to remote
Not sure how to achieve rename with synchronize, when I test keepuptodate it works.

How to code it to make delete and rename work at any time?


Thanks for your help.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24995
Location: Prague, Czechia
Deleting is not supported in the "both" mode. There's no way WinSCP can tell, if a file/folder was added on one side or removed from the other.

Removing is similar. How can WinSCP tell that a file was renamed, vs. one file deleted and another file added.

Both problems would require WinSCP to keep the previous state of files somewhere and compare against that.
Advertisements

You can post new topics in this forum






Search Site

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!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License