Re: List root folder.
If I want to enter the root folder of the ftp server what should I write in remotePath?
Login with GUI, browse to the "root" folder and check what path do you see in WinSCP panel. It would typically be
/
.
Also, i used directoryInfo.Files.OrderBy to order by time, is there a way to filter the files like only retrieve the *.bmp files?
There's
Enumerable.Where
extension method:
https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.where
Or you can use
Session.EnumerateRemoteFiles
instead of Session.ListDirectory
. It supports filtering file by file mask.
https://winscp.net/eng/docs/library_session_enumerateremotefiles
Both approaches are covered in my answer to:
https://stackoverflow.com/q/34680848/850848
Also see
https://winscp.net/eng/docs/library_example_listing_files_matching_wildcard