Post a reply

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

Sachin

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

Thanks Martin
martin

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.
Sachin

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.