vba calling Winscp to connect and download files through SFTP

i8890321

New Member
Joined
Jul 21, 2014
Messages
6
Hi,

I am using a vba script, it uses winscp to connect the SFTP and download the files one by one.


This is the line i used in vba
====================================
strQuote = Chr(34)
strOpen = "open sftp://acc:pw@host.com"
GetPath = "get ""folder/file1.doc"" ""C:\folder\file1.doc"""

Call Shell("C:\winscp\winscp.com /command " & strQuote & strOpen & strQuote & GetPath & " " & strQuote & "exit" & strQuote, vbNormalNoFocus)
=====================================
As i want to speed up all the things, i loop the above command for every files to be download.
E.G. I got 1k files on the remote side, I want to download 50 specific files only. My script will open 50 sessions (50 winscp windows and connections) which makes my computer hang.

If i just open 1 session (1 winscp window), it form a queue of 50 files and the speed is very slow.

can any one give me a better solution?

Sorry for my bad english and poor programming knowledge.

Thanks
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hi,

Sorry, I am not an expert in ftp but I strongly suspect that the host server will impose a limit on how many files a given user can download at once. Do you know what that limit is?

It will probably work better if you base any code on that number and don't try to exceed it.

Some sites limit bandwidth as well, so even if you get several files downloading at the same time they may do so more slowly.
 
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,820
Members
449,469
Latest member
Kingwi11y

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top