Post a reply

Options
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)

Options

Topic review

martin

Re: Automatic Script to Synchronize remote directory to local directory

The error refers to this line:
# Synchronize Remote to Local d:\

Your batch file syntax is wrong.
You have specific instance of this issue:
https://winscp.net/eng/docs/faq_batch_file#newline_escaping
Also, the // should not be there.
The correct syntax would be:
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\winscplog\WinSCP.log" /ini=nul ^
  /command ^
    "open ftp://xxxx:xxxx@10.x.x.x/" ^
    "# Synchronize Remote to Local d:\" ^
    "synchronize local -delete D:\ftproot\SysExpDat\CDR /SysExpDat/CDR" ^
    "# Disconnect" ^
    "exit"
rileys@unitedtelcom.net

Automatic Script to Synchronize remote directory to local directory

I'm having trouble getting a batch script to work for the synchronize command.
Here is my .bat script:
@echo off
 
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\winscplog\WinSCP.log" /ini=nul ^
  /command ^
    "open ftp://xxxx:xxxx@10.x.x.x/" ^
# Synchronize Remote to Local d:\
   "synchronize local -delete // D:\ftproot\SysExpDat\CDR /SysExpDat/CDR" ^
# Disconnect
    "exit"
 
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
 
exit /b %WINSCP_RESULT%

When I check the logs, it logs in via FTP just fine, however the synchronize command is failing with the following error:
2022-01-14 10:04:30.767 Script: Missing parameter for command 'synchronize'.

I have tried double quotes, single quotes, removing the //, and same error in all instances.