powershell connection to sftp via WinSCP

Advertisement

clt
Guest

powershell connection to sftp via WinSCP

Hi, thank you for Winscp!
I'm trying to make script in powershell to download and upload files to sftp server. It works well, but I need to check if the folder where I want to upload files is empty. Next thing I need to make is compare the length of files transfered to sftp with files on my local disc. I'm using

if (@(Compare-Object $files_sftp $files_local -SyncWindow 0).Length -eq 0) {
Write-Host "OK" }
else { Write-Host "NOT ok" }

So I need to get content of remote directory with powershell command Get-Childitem to variable $files_sftp or some general advice how to connect winscp scipting with powershell.
Thank you very much!

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum