EldoS | Feel safer!

Software components for data protection, secure storage and transfer

TElSimpleSFTPClient GetFiles?

Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.
Posted: 02/22/2008 06:41:29
by Marius  (Basic support level)
Joined: 02/22/2008
Posts: 1


Is there an method on the TElSimpleSFTPClient.

which resembles the:C# Directory.GetFiles(string directory, string search pattern)?

string[] downloadedFiles = Directory.GetFiles(tempFolder, filter);

I need an list/Array containing the files in an specific directory on an sFtp server
Posted: 02/22/2008 06:56:26
by Eugene Mayevski (EldoS Corp.)

You can use the following approach:

1) Get directory contents using ReadDirectory() method
2) For each file name retrieved use SBUtils.Unit.FilenameMatchesMask() method to check if it matches your mask
3) Use DownloadFiles() method to retrieve the files you need.

I've added a task to ToDo list to introduce ReadDirectoryEx which will accept the mask and eliminate the need for step 2.

Sincerely yours
Eugene Mayevski
Posted: 02/22/2008 06:58:07
by Eugene Mayevski (EldoS Corp.)

Well, if you need to only download the files and don't need to read the directory contents before retrieval, then you don't need steps 1 and 2 at all. DownloadFiles will download files by mask.

Sincerely yours
Eugene Mayevski
Posted: 03/12/2008 13:39:59
by Eugene Chernyak (Standard support level)
Joined: 03/10/2008
Posts: 2

When I use DownloadFiles methods is there a way to find out which files have been downloaded based on mask and transfer options (ivewrite vs skip),...

Thank you
Posted: 03/12/2008 13:57:31
by Eugene Mayevski (EldoS Corp.)

There's OnFileOperation event that might be used for your purposes.

Sincerely yours
Eugene Mayevski
Posted: 03/12/2008 15:02:50
by Eugene Chernyak (Standard support level)
Joined: 03/10/2008
Posts: 2

Thank you. It worked great except one detail. I used TSBSFTPFileTransferMode.ftmSkip in DownloadFiles() method and it did skip existing file. I expected that OnFileOperation() event will set Skip to True for this file but it sets it to False. I wanted to know which files were actually transferred and which one were skipped because they already exist.

Thank you again for your prompt and helpful responses,

Eugene Chernyak
Posted: 03/13/2008 00:43:20
by Eugene Mayevski (EldoS Corp.)

Unfortunately there's no way to find this out at the moment because OnFileOperation is invoked in DownloadFileS, and file existence is checked in DownloadFile. I think we need to add some property that will contain a list of processed files.

Sincerely yours
Eugene Mayevski
Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.



Topic viewed 3552 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!