Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. // Setup session options
  2. SessionOptions sessionOptions = new SessionOptions
  3. {
  4. Protocol = Protocol.Sftp, // Can be SFTP, FTPS, or plain FTP
  5. HostName = Dts.Variables["$Package::pHostName"].Value.ToString(),
  6. UserName = Dts.Variables["$Package::pUserName"].Value.ToString(),
  7. Password = Dts.Variables["$Package::pPassword"].GetSensitiveValue().ToString(),
  8. GiveUpSecurityAndAcceptAnySshHostKey = true
  9. };
  10.  
  11.  
  12. // Set up the FTP session, specifying the path to the server directory
  13. Session session = new Session
  14. {
  15. ExecutablePath = Dts.Variables["$Package::pWinScpExecutablePath"].Value.ToString()
  16. };
  17.  
  18.  
  19. // Connect
  20. session.Open(sessionOptions);
  21.  
  22. // Specify which directory on the FTP server to list
  23. RemoteDirectoryInfo directory = session.ListDirectory(Dts.Variables["$Package::pRemotePath"].Value.ToString());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement