Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


Problem with Synchronize Command


Thanks for the help I will test this now. Also I am looking to run the script in a loop but is seems WinSCP does not support the goto function of script.

Is this the case or is there another command I could use to constantly check the remote directory and any changes immediately download to the local one?

Re: Issue with Synchronize Command

This is not really WinSCP question. It's your batch file syntax that is wrong:
Why are some WinSCP scripting commands specified in a batch file not executed/failing?
You need to indent the wrapped lines. And the ^ after the exit line should not be there:
"C:\Program Files (x86)\WinSCP\" ^
  /log="C:\Users\james.QUINTA\Desktop\WinSCP.log" /ini=nul ^
  /command ^
  "open" ^
  "lcd C:\Users\james.QUINTA\Desktop\Pictures" ^
  "cd /DCIM/Camera" ^
  "synchronize local" ^

I have no idea how can the script work on any machine.

Issue with Synchronize Command

Hi all, Firstly I am a bit of a noob so sorry if this is an easy solve. I have just setup a FTP server on a tablet in my warehouse and I wanted to sync the pictures to a folder on my desktop.

I tested this using the below on my own PC:-
@echo off
"C:\Program Files (x86)\WinSCP\" ^
/log="C:\Users\james.QUINTA\Desktop\WinSCP.log" /ini=nul ^
/command ^
"open" ^
"lcd C:\Users\james.QUINTA\Desktop\Pictures" ^
"cd /DCIM/Camera" ^
"synchronize local" ^
"exit" ^
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error

This works a treat and very reliable. However when I move the same to the other PC I am getting the below on the log:-
. 2022-06-23 10:17:02.234 Using FTP protocol.
. 2022-06-23 10:17:02.234 Doing startup conversation with host.
< 2022-06-23 10:17:02.235 Script: Starting the session...
> 2022-06-23 10:17:02.235 PWD
< 2022-06-23 10:17:02.239 257 "/" is current directory.
. 2022-06-23 10:17:02.239 Getting current directory name.
. 2022-06-23 10:17:02.239 Startup conversation with host finished.
< 2022-06-23 10:17:02.239 Script: Session started.
< 2022-06-23 10:17:02.240 Script: Active session: [1] anonymous@
> 2022-06-23 10:17:02.241 Script: lcd C:\Users\warehouse\OneDrive\Desktop\Pictures
< 2022-06-23 10:17:02.241 Script: C:\Users\warehouse\OneDrive\Desktop\Pictures
> 2022-06-23 10:17:02.243 Script: cd /DCIM/Camera
. 2022-06-23 10:17:02.243 Changing directory to "/DCIM/Camera".
> 2022-06-23 10:17:02.243 CWD /DCIM/Camera
< 2022-06-23 10:17:02.247 250 Directory changed to /DCIM/Camera
. 2022-06-23 10:17:02.247 Getting current directory name.
> 2022-06-23 10:17:02.248 PWD
< 2022-06-23 10:17:02.251 257 "/DCIM/Camera" is current directory.
< 2022-06-23 10:17:02.251 Script: /DCIM/Camera
> 2022-06-23 10:17:02.252 Script: Sychronize local
< 2022-06-23 10:17:02.253 Script: Unknown command 'Sychronize'.
. 2022-06-23 10:17:02.253 Script: Failed
. 2022-06-23 10:17:02.253 Script: Exit code: 1
. 2022-06-23 10:17:02.260 Disconnected from server

I have tried making the S a small s but this has not affect whatsoever,

Can anybody help? Also it would be nice if this script could loop itself continuosly if anybody can post some ideas it would be appreciated.