Deployer\Server\Remote\NativeSsh::scpCopy PHP Method

scpCopy() public method

Copy file from target1 to target 2 via scp
public scpCopy ( string $target, string $target2 ) : string
$target string
$target2 string
return string
    public function scpCopy($target, $target2)
    {
        $serverConfig = $this->getConfiguration();
        $scpOptions = [];
        if ($serverConfig->getPort()) {
            $scpOptions[] = '-P ' . escapeshellarg($serverConfig->getPort());
        }
        if ($serverConfig->getPrivateKey()) {
            $sshOptions[] = '-i ' . escapeshellarg($serverConfig->getPrivateKey());
        }
        $scpCommand = 'scp ' . implode(' ', $scpOptions) . ' ' . escapeshellarg($target) . ' ' . escapeshellarg($target2);
        $process = new Process($scpCommand);
        $process->setTimeout(null)->setIdleTimeout(null)->mustRun();
        return $process->getOutput();
    }