Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Setup session options
- SessionOptions sessionOptions = new SessionOptions
- {
- Protocol = Protocol.Sftp, // Can be SFTP, FTPS, or plain FTP
- HostName = Dts.Variables["$Package::pHostName"].Value.ToString(),
- UserName = Dts.Variables["$Package::pUserName"].Value.ToString(),
- Password = Dts.Variables["$Package::pPassword"].GetSensitiveValue().ToString(),
- GiveUpSecurityAndAcceptAnySshHostKey = true
- };
- // Set up the FTP session, specifying the path to the server directory
- Session session = new Session
- {
- ExecutablePath = Dts.Variables["$Package::pWinScpExecutablePath"].Value.ToString()
- };
- // Connect
- session.Open(sessionOptions);
- // Specify which directory on the FTP server to list
- RemoteDirectoryInfo directory = session.ListDirectory(Dts.Variables["$Package::pRemotePath"].Value.ToString());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement