buildScpCommand

fnstring buildScpCommand(ScpDirection direction, scope const(ubyte)[] remotePath, ScpCommandOptions options = ScpCommandOptions.init)

Builds the remote scp command for a single-file transfer.

The command runs the configured program in sink (-t, send) or source (-f, receive) mode, adds -p when preserved times are requested, and appends one shell-quoted pathname. Relative pathnames starting with - are rewritten with a ./ prefix so remote option parsing can never consume them. The program name is caller-configured and emitted verbatim; it must be a bare command name or path that is safe for the remote shell.

Parameters

directionTransfer direction selecting sink or source mode.
remotePathRemote pathname bytes (protocol bytes).
optionsCommand options.

Returns

The command string for an exec channel request.

Throws

ScpException when the pathname fails

validateScpRemotePathname, the program name is empty or contains a NUL byte, or the result exceeds ScpLimits.commandMax.