Property Filter
Filter
Chooses what UploadDirectoryAsync(string, string, SftpTransferOptions?, CancellationToken) and DownloadDirectoryAsync(string, string, SftpTransferOptions?, CancellationToken) transfer: called for each file and directory of the source tree with its path relative to the top directory and its attributes, it returns false to leave the entry out. A directory left out is neither created nor entered, so nothing below it is transferred (or passed to the filter). Null (the default) transfers everything. The single-file methods ignore it.
public Func<SftpTransferEntry, bool>? Filter { get; init; }
Property Value
Remarks
It sees regular files and directories only: symbolic links, special files and names this system cannot hold are skipped before it is asked, as without a filter. What it leaves out is counted in Excluded; nothing is deleted at the destination.
It is called for one entry at a time, never concurrently, before the entry is transferred; with MaxConcurrentFiles above 1, an upload asks it about the whole tree first, and a download as the tree is listed, while files are in flight. An exception it throws fails the transfer. To match names with a wildcard pattern, see MatchesSimpleExpression(ReadOnlySpan<char>, ReadOnlySpan<char>, bool).