Topic "Want to automate download of files from Sftp to local directory using batch file"

Author Message
anika

Guest


hi all,

i want to download files from sftp folder using batch file to any of my local folder .

Could any one give a detailed description on how to do the same ?

thanks in advance.
Advertisements
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26748
Location: Prague, Czechia
Please read documentation:
https://winscp.net/eng/docs/guide_automation

If that does not help, come back.
Anika

Guest


I cannot find the console window in winscp where I have to write Commands for automation .Can you guide those steps to me as I am new to this .

I tried to find that window from Commands -> Open Terminal in Winscp but got this error :

Error skipping startup message. Your shell is probably incompatible with the application (BASH is recommended).

Thanks in advance .
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26748
Location: Prague, Czechia
You do not enter the commands in WinSCP GUI.

You have to use command-line:
https://winscp.net/eng/docs/scripting#using_scripting
MM
[View user's profile]

Joined: 2017-05-10
Posts: 1
Hi , I am kind of a beginner in VBA. I want to download a file from remote server to local. Certain files get stored in subdirectories of a root folder and the subfolder names can be dynamic. I have the file name with me. I need to download the file from winscp to location without giving exact path

path : /u/test/
filename: a.txt
if this file is stored in /u/test/*/ (any subfolder , how can write the shell command)

errorCode = wsh.Run("C:\winscp577\WinSCP.com /command ""open user:pwd@domain"" ""lcd " & tempLocation & """ ""get /u/test/*/a.txt""" ""exit""", windowStyle, waitOnReturn)

The above code does not seem to work
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26748
Location: Prague, Czechia
MM wrote:
Hi , I am kind of a beginner in VBA. I want to download a file from remote server to local. Certain files get stored in subdirectories of a root folder and the subfolder names can be dynamic. I have the file name with me. I need to download the file from winscp to location without giving exact path

path : /u/test/
filename: a.txt
if this file is stored in /u/test/*/ (any subfolder , how can write the shell command)

errorCode = wsh.Run("C:\winscp577\WinSCP.com /command ""open user:pwd@domain"" ""lcd " & tempLocation & """ ""get /u/test/*/a.txt""" ""exit""", windowStyle, waitOnReturn)

The above code does not seem to work

So do you want to download all files stored anywhere in a remote directory tree to the same local folder?

See https://winscp.net/forum/viewtopic.php?t=23759

Though you cannot use Session.EnumerateRemoteFiles in VBA. So you have to recursively use Session.ListDirectory.
Advertisements

You can post new topics in this forum

Search

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!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License