Property SkipUnreadableDirectories
SkipUnreadableDirectories
In UploadDirectoryAsync(string, string, SftpTransferOptions?, CancellationToken) and DownloadDirectoryAsync(string, string, SftpTransferOptions?, CancellationToken), leave out a subdirectory of the
source tree that this user may not read, and go on with the rest (default false: the transfer fails with the error, as
cp -r stops). A remote directory qualifies when the server refuses its listing with
PermissionDenied, a local one when this system refuses it (UnauthorizedAccessException).
What was left out is in UnreadableDirectories. The single-file methods ignore it.
public bool SkipUnreadableDirectories { get; init; }
Property Value
Remarks
A directory left out is not created at the destination, nor counted in Directories, and nothing is deleted there: an earlier copy stays as it is. Only a refusal for want of permission qualifies: a directory deleted meanwhile, any other status, a file that cannot be read, and a broken session or connection still fail the transfer. The top directory is not skipped: when it cannot be read, the transfer fails.
Use it for a tree that holds directories of other users or of the system (a home directory with a private .cache, a share
with restricted folders), where a partial copy is the expected outcome. Check
UnreadableDirectories afterwards when a complete copy matters.