From() public method

Copies a file from a remote SSH machine to the local machine using SCP.
public From ( string remoteFile, string localPath ) : void
remoteFile string The remmote file name
localPath string The local destination path
return void
示例#1
0
        public void SFtpDownload()
        {
            string remoteFilename = string.Format("{0}/{1}", _remoteDirectory, _remoteFilename);

            //Create a new SCP instance
            Scp scp = new Scp();

            //Copy a file from remote SSH server to local machine
            scp.From(_remoteHost, remoteFilename, _user, _password, _localFilename);
        }
        public static void TransferFileFromMachine(string remoteFile, string localPath)
        {
            try
            {
                //Create a new SCP instance
                Scp scp = new Scp(MACHINE_IP, USER_NAME, PASSWORD);

                scp.Connect();

                //Copy a file from remote SSH server to local machine
                scp.From(remoteFile, localPath);

                scp.Close();
            }
            catch (Exception)
            {

                throw;
            }
        }