Topic "How to Control number of files to be transferred in session"

Author Message
[View user's profile]

Joined: 2013-02-19
Posts: 9
Location: Mumbai
Hi All,

Thanks to all WinScp developers who has developed such good utility. I have some questions regarding WinScp 5.1.7 and its .Net library.
I am planning to use WinScp version 5.1.7 and its .Net library. Especially I will use GetFiles method session class. This method pulls all files from FTP location to local folder .Is there any method to limit number of files to be transferred at a time.

Suppose my remote FTP/SFTP directory contains 10 files. Their names are
X0905.A05.502, OIMX0905.A05.500, NOMX0905.A05.500, DBMX0905.A05.500, CSOX0905.A05.500, CBMX0905.A05.500, AMLX0905.A05.500, CSOY0905.A05.500, CBMY0905.A05.500, and AMLY0905.A05.500.

I have to pick up any 5 files () which are having X in their names.For this I can write my GetFiles code as below,

 Dim transferResult As TransferOperationResult
 transferResult = session.GetFiles("/FTP/*X*", "E:\Local\*", False, transferOptions)

This code copies all 7 files which fits into search criteria (i.e. *X*).How can I control this number of files to be transferred in one session.

Please Note: - Here for example purpose I have kept numbers as 10 and 7.But in actual my application would handle more than 5000 files which are having same naming pattern. Now if WinScp start transferring 5000 files in one session it would block my entire network bandwidth or simply I can say that it would increase network overhead. Hence I am asking this question.
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
You have to do this manually by retrieving a list of all files (Session.ListDirectory) and picking your 5 out of them, calling Session.GetFiles for each individually.
Martin Prikryl
[View user's profile]

Joined: 2013-02-19
Posts: 9
Location: Mumbai
Thanks Martin

You can post new topics in this forum

Search Site

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