I'm not sure I completely understand what exactly is the problem here. In Rebex FTP, there is FtpItem
object and FtpList
object (a collection of FtpItem
objects). In Rebex SFTP, there is SftpItem
and SftpItemCollection
(a collection of SftpItem
objects. FtpItem
is very similar to SftpItem
and FtpList
is very similar to SftpItemCollection
.
To check whether an item is a file or directory, you can either use IsFile
and IsDirectory
properties or the Type
property. Example:
Sftp sftp = new Sftp();
sftp.Connect("server01", 22);
sftp.Login("tester01", "password");
SftpItemCollection list = sftp.GetList();
foreach (SftpItem item in list)
{
// display last modification date
Console.Write(item.Modified.ToString("u"));
// display item type (usually a directory or file)
Console.Write(item.Type.ToString().PadLeft(16, ' '));
// display item size
Console.Write(item.Size.ToString().PadLeft(10, ' '));
// display item name
Console.Write(" {0}", item.Name);
Console.WriteLine();
}