The ListDir method will send a request to the server to
retrieve a FULL listing of a directory specified by the RemotePath argument. Once the server sends data, the
ListItems event
will be fired (possibly more than once!!) containing a list
of files sent by the server, each one on separate line,
split by a CRLF sequence. The ListItems event is fired more than
once if the total number of files is too large to be handled by
one SFTP packet. You should wait for the Done event to declare the
listing as finished.
Once completed, the Done event will be fired. If no error
occurs, the ErrorCode argument in the Done
event will be set to 0 (zero). If an error occurs,
ErrorCode will hold the number of the
error and ErrorText will contain a
description for the error.
No wildcards can be used for the RemotePath argument. The RFC protocol specification
for SFTP does not allow them.
To get just filenames (and directory names) for a specific
path, you can use the ListNames method.
To retrieve the structure of the directory inside an already parsed
collection of SftpItem objects, you should
use the ListAttributes
method.