Topic "SFTP command line to copy Folder and contents to local C:\"

Author Message
[View user's profile]

Joined: 2014-03-31
Posts: 6
Location: UK
Hi everyone,
I am trying to get WINSCP to connect to an SFTP site and download a folder structure and contents.

Folder 1
> File1
> File2
> File1
> File2

I am currently using the following script which works for copying a single file but need it changed to copy full folder structure including files within each folder.

# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
open sftp://UserName:Password@IP:Port/
# Change remote directory
cd /QlikView/COMPLIANCE/
# Force binary mode transfer
option transfer binary
# Download file to the local directory d:\
get Test.txt c:\Temp\
# Disconnect
# Exit WinSCP

Any help would be greatly appreciated.
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27106
Location: Prague, Czechia
Command get can download even folder, not only file. Just specify a path to a folder as its argument. Do not forget to terminate path with slash.
Martin Prikryl

You can post new topics in this forum


What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License