Is SFTP possible in SSIS package without using WinSCP -
i having ssis package ftp. need change sftp, there possibility can use ftp task , sftp, or sftp without using winscp.
not out of box. there other tasks available can use sftp library in script, or use sftp powershell command. paid components better of sftp tasks you'll find seem bit ... dated , ui bit clunky.
for starters, check ssis sftp task component. depends on sharpssh, library hasn't been updated since 2013
on other hand, posh-ssh , underlying library, ssh.net had release few weeks ago.
in case, ended using posh-ssh powershell script because allowed me compare directory listings of remote , local files, detect new files standard powershell operations , download newer/changed files using sftp.
for example, following powershell function retrieve both listings , compare them using compare-object command:
function get-diffs( $session,$remotepath,$localpath) { $remotefiles=get-sftpchilditem -sftpsession $session -path $remotepath $localfiles=get-childitem $localpath compare-object -referenceobject $localfiles -differenceobject $remotefiles -property "name" -passthru }
the result contains sideindicator
property shows files have moved 1 side another. eg:
$newfiles=$diffs|where sideindicator -eq '=>' ... foreach ($f in $newfiles) { get-sftpfile -sftpsession $session -remotefile $f.fullname -localpath $dropfolder -overwrite }
doing same thing ssis lot harder.
Comments
Post a Comment