Пример #1
0
        public static bool UploadFile(String localPath, String remotePath)
        {
            SshConnectionInfo objInfo = new SshConnectionInfo();

            objInfo.User = "******";
            objInfo.Host = "106.75.3.227";
            objInfo.Pass = "******"; //基于密码
            SFTPHelper objSFTPHelper = new SFTPHelper(objInfo);

            return(objSFTPHelper.Upload(localPath, remotePath));
        }
Пример #2
0
        public static bool mkDir(String remotePath)
        {
            SshConnectionInfo objInfo = new SshConnectionInfo();

            objInfo.User = "******";
            objInfo.Host = "106.75.3.227";
            objInfo.Pass = "******"; //基于密码
            SFTPHelper objSFTPHelper = new SFTPHelper(objInfo);

            return(objSFTPHelper.ftpMkdir(remotePath));
        }
Пример #3
0
        public SFTPHelper(SshConnectionInfo connectionInfo)
        {
            m_sshCp = new Sftp(connectionInfo.Host, connectionInfo.User);

            if (connectionInfo.Pass != null)
            {
                m_sshCp.Password = connectionInfo.Pass;
            }

            if (connectionInfo.IdentityFile != null)
            {
                m_sshCp.AddIdentityFile(connectionInfo.IdentityFile);
            }
        }