How to Control number of files to be transferred in session

Advertisement

Sachin
Joined:
Posts:
9
Location:
Mumbai

How to Control number of files to be transferred in session

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.
Question:-
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.

Explanation:-
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.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: How to Control number of files to be transferred in session

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

Reply with quote

Advertisement

You can post new topics in this forum