Search code examples
ftpwinscpsynchronize

FTP transfer with WinSCP - Getting "Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead."


I use this code to copy files from the server to a local folder

option batch abort
option confirm off
open ftp://Emna:root@localhost
synchronize local C:\Users\User\Documents /Projets/SPR/Sources
exit

I run the script using this command:

winscp.com /RemoteScript.txt

But it doesn't work.

I'm getting this error:

Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.

What can I do to copy files from the server to a local folder using a script?


Solution

  • You have to use /script switch to specify the script file:

    winscp.com /script=RemoteScript.txt
    

    For general overview, see the guide to automating transfers from FTP server with WinSCP.