It seems FtpItem.ItemParse event is not called for Sftp?
We tested this site: demo.wftpserver.com:2222 and found out the listing does not parse the file permissions and the owner/group correctly so we wanted to handle the parsing ourselves.
FtpItem.ItemParse event only affects the behavior of Ftp class from Rebex.Ftp.dll assembly. The Sftp class comes from Rebex.Sftp.dll assembly, which is independent of Rebex.Ftp.dll.
In FTP protocol, the listing is parsed from text. But in SFTP, this is not the case, because the protocol provides all relevant data in binary form. SFTP v3 still provides raw FTP-like listing for each SFTP item, but this is not used by the client when creating SftpItemCollection with SftpItem instances.
Rebex SFTP does parse the owner ID and group ID correctly (0/0 correspnds to root/root). However, the server only supports SFTP v3, where a string-based owner/group ID is not transmitted as a field, and only a number is present instead. If you need to retrieve owner/group names, then parsing the FTP-like raw listing is the only way to go (see below)
Rebex SFTP does parse the permissions field correctly. But the server at demo.wftpserver.com:2222 seems to suffer from a bug that makes it report different permissions in the permissions field and in the raw listing. The permissions field contains 0x81B6 (for regular files in "/download" directory), which is 100666 in octal and corresponds to '-rw-rw-rw'. The raw listing contains '-rw-r--r--'. The discrepancy makes this obviously a server-side bug.
If you actually wish to purchase a Wing FTP Server license, report this bug to the vendor and get it fixed. Working around server-side bugs at the client side should really be a last resort solution.
If you are just using that server to test your application, perhaps using a different server that doesn't suffer from bugs in such basic functionality would be a better option. Try Rebex Tiny SFTP Server or test.rebex.net:22.
If you prefer to work around this server-side bug at the client side, or if you need to determine owner/group in string form, call Sftp.GetRawList() and parse the results using FtpItem (from Rebex.Ftp.dll). The following GetCustomParsedList extension method shows how to achieve that:
public static FtpItemCollection GetCustomParsedList(this Sftp sftp)
var list = new FtpItemCollection();
foreach (string rawLine in sftp.GetRawList())
var item = FtpItem.Parse(rawLine);
Welcome to Q&A forum for C# and VB.NET developers working with following .NET components:
If you need immediate assistance, please contact us directly.