Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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: SFTP command line to copy Folder and contents to local C:\

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.
See https://winscp.net/eng/docs/scriptcommand_get
Welshhop

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

Hi everyone,
I am trying to get WINSCP to connect to an SFTP site and download a folder structure and contents.
i.e.

Folder 1
>SubFolder1
> File1
> File2
>SubFolder2
> 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
close
# Exit WinSCP
exit


Any help would be greatly appreciated.