head
-like filters if possible.-q
option to tell sftp
to be quiet, thereby suppressing most of the output you don't care about:sftp> ls *.txt
, but those can be filtered out with a grep -v
:-b
parameter to sftp
rather than echo
ing a pipeline into it.ssh
than with sftp
(which, after all, is the secure file transferprogram):ChangeDirectory
and ListDirectory
do not work as you may expect. ChangeDirectory
method has no effect on the ListDirectory
method unless you specify a folder in the parameter of this method. Seems like a bug should be written for this.ListDirectory
call as you iterate over the folders. The listing returns an enumerable of SftpFiles. These can then be checked individually for IsDirectory true
. Just be aware that the listing also returns the .
and ..
entries (which are directories). You'll want to skip these if you want to avoid an infinite loop. :-)ChangeDirectory
, since it's using the Fullname
for the ListDirectory
: