D
D
Dmitry Klyucharov2020-11-08 18:10:32
SFTP
Dmitry Klyucharov, 2020-11-08 18:10:32

WinSCP has an error while syncing files from a script?

Good afternoon!
I want to synchronize the contents of the local and remote directory, which is connected via SFTP using WinSCP.
Created bat:

@echo on
"C:\Program Files (x86)\WinSCP\WinSCP.exe" /script=D:\WinSCP_script.txt /log=D:\winscplog.txt
pause

Created a WinSCP_script.txt script:
option batch abort
option confirm off

# Connect
open sftp://user:[email protected]:4286/ -hostkey="ssh-ed25519 255 cB0bHayI/GWWkrmjsVM5Vus1QsyHxVtSEu7MHOMxcIU="
lcd D:\test_sync
cd /work/test_sync

# synchronize files from server
synchronize remote "D:\test_sync" "/work/test_sync"

# Disconnect
close
exit

The test was simple. On the server, the /work/test_sync directory is empty. I put a small file on the local machine. As a result, the file did not appear on the remote machine.
If the same files lie on the local and remote machine and then I change it on the local machine, then it also changes on the remote machine. But what about new files?
With the help of the graphical shell, everything is synchronized correctly.
WinSCP writes the following in the log file:
. ...2020-11-08 18:06:16.003 Local file 'D:\test_sync\1.torrent' [2020-11-08T13:31:43.000Z] [55822] is new
< 2020-11-08 18: 06:16.004 Script: No objects to sync.

WinSCP has been updated to the latest version.
What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question