Windows – How to download images from FTP to local folder using WinSCP command Line

command lineftpwindowswinscp

I am trying to use the WinSCP command line to access an FTP Server. Then download all JPEG's in the root folder and download them to a local folder on my C: drive.

Example of my script below.

>"C:/Program Files (x86)/winscp/winscp.exe" /open ftp://hostname;password@ipaddress/

This opens the connection but when I try to download all the images from the root folder using this.

>get /*.jpg

It times out.
Is there a better way to connect and get all images available?

Ideally I will put this in a batch file eventually when it works.

Best Answer

Use a batch file (e.g. download.bat) like:

"C:\Program Files (x86)\WinSCP\winscp.com" ^
    /ini=nul /log=C:\writable\path\to\winscp.log /command ^
    "open ftp://hostname:password@ftp.example.com/" ^
    "get /*.jpg C:\local\path\" ^
    "exit"

Some references:


You can even have WinSCP generate the script/batch file for you:

enter image description here

Related Question