Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

clt

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!