question-closed How to limit record count while fetching data to sftpitemcollection via Rebex?

0 votes
asked Feb 13 by alexander.junior (280 points)
closed Feb 14 by alexander.junior

Currently I am fetching all the files from the folder configured after connection to sftp.If the count of files is very large(say 800000 files or so) time out is happening. We want to limit the number of files to be fetched. We are currently fetching the files as below:

            SftpItemCollection list = dSftp.GetList(strServerPath + "//" + "*." + extension);

            foreach (SftpItem item in list)
                dtOutput.Rows.Add(strFileType, item.Name);////, item.Size.ToString(), item.Modified.ToString("dd/MM/yyyy HH:mm:ss"));

closed with the note: to be more precise
Applies to: Rebex SFTP
commented Feb 14 by alexander.junior (280 points)
Is it possible to fetch 100 records alone out of the (say  8 lakh records ) via sftp Rebex. Please provide a solution asap
commented Feb 14 by Lukas Matyska (40,700 points)
Please note that SFTP version 4 doesn't support paging for directory listing.  See for details.

You can fetch files continuously in small chunks from the "beginning" of the directory. You can finish fetching when you find specific file (or when whole directory is listed).

This can be done using `Sftp.ListItemReceived` event handler.