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

4

1

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.

Fendec

Posted 2016-06-30T11:42:41.003

Reputation: 275

Answers

3

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

Martin Prikryl

Posted 2016-06-30T11:42:41.003

Reputation: 13 764

1

try

get *.jpg

or

get -filemask=*.jpg -resumesupport=on *

More examples here:http://winscp.net/eng/docs/scriptcommand_get

Frank Thomas

Posted 2016-06-30T11:42:41.003

Reputation: 29 039