Questions tagged [winscp-net]

The WinSCP .NET assembly (winscpnet.dll) is a .NET wrapper around WinSCP's scripting interface that allows your code to connect to a remote machine and manipulate remote files over SFTP, FTP, WebDAV and SCP sessions from .NET languages, such as C#, VB.NET, and others, or from environments supporting .NET, such as PowerShell and SQL Server Integration Services (SSIS).

The WinSCP .NET assembly winscpnet.dll is a .NET wrapper around WinSCP's scripting interface that allows your code to connect to a remote machine and manipulate remote files over SFTP, FTP, WebDAV and SCP sessions from .NET languages, such as C#, VB.NET, and others, or from environments supporting .NET, such as PowerShell and SQL Server Integration Services (SSIS).

For details see:

The assembly is also exposed to COM, and as such it can be used from variety of other programming languages and development environments--e.g., WSH-hosted active scripting languages like JScript and VBScript, Visual Basic for Applications (VBA), Perl, and Python.

For details see:

The library is primarily intended for advanced automation tasks that require conditional processing, loops or other control structures for which the basic scripting interface is too limited. The library is not a general purpose file transfer library. It particularly lacks support for interactive processing and as such it is not well suited for use in GUI applications.

Use tag for all WinSCP related questions, along with .

339 questions
2
votes
0 answers

Including WinSCP with PackageReference copies Winscp.exe in MY package

I have a problem with the WinSCP.exe file in my created NuGet package. I reference WinSCP in my project as follows: After packing my NuGet package, the winscp.exe is copied to the package in…
2
votes
1 answer

Transfer files which contains only digits and not letters using WinSCP in C#?

I tried below with no success - string mask = "Report01|*[A-Z]" +"*.txt"; //This line fails to select files which contains only digits TransferOperationResult transferResult; transferResult = session.getFiles("RemoteServerPath"…
Omkar Godse
  • 81
  • 1
  • 8
2
votes
2 answers

PowerShell and WinSCP script to check if there are more than 4 files in a SFTP remote directory

With PowerShell language and WinSCP I'm trying to create a script that daily check an SFTP remote directory to see if there are more than 4 files into it. If there are less than 4 files it's okay but if there are more that 4 files it will output an…
2
votes
1 answer

Case insensitive folder name matching using WinSCP and C#

I am working on a project where I am using WinSCP .NET component for accessing an SFTP host. The functionality of the code is to navigate to a folder in the SFTP and checks whether the provided file name is located inside the folder. I have the…
Karthik Venkatraman
  • 1,619
  • 4
  • 25
  • 55
2
votes
1 answer

How to load WinSCPnet.dll assembly in PowerShell 2.0? (This assembly is built by a runtime newer than the currently loaded runtime)

I'm trying to load WinSCPnet.dll file using below code in PowerShell, and I'm getting below error. Set-Location "D:\WinSCP-5.17.10-Automation" Add-Type -Path "WinSCPnet.dll" Add-Type : Could not load file or assembly…
Nirav sachora
  • 113
  • 1
  • 5
  • 12
2
votes
2 answers

Using WinSCP in PowerShell to compare FTP to local directories

Trying to use WinSCP and PowerShell to list the remote and local directories comparing the lowest level to then transfer the directories on the remote missing from the local. Listing works for both remote and local but the comparison -contains…
Deuian
  • 831
  • 1
  • 6
  • 12
2
votes
1 answer

WinSCP .NET library FTP transfer fails with "IP addresses of control and data connection do not match"

I have implemented FTP code with use of WinSCP .NET assembly and hosted it on an Azure AppService. It works locally and on Azure. But in very few random times, when hosted on Azure, it throws the following error: Error transferring file…
Menelaos Vergis
  • 3,715
  • 5
  • 30
  • 46
2
votes
1 answer

Location for SSH private key and temporary SFTP download data in Azure functions

I am writing an Azure function that uses WinSCP library to download files using SFTP and upload the files on blob storage. This library doesn't allow to get files as a Stream. Only option is to download them locally. My code also uses a private key…
Raas Masood
  • 1,475
  • 3
  • 23
  • 61
2
votes
1 answer

WinSCP using PowerShell is adding a directory to the SFTP site I'm uploading to

I'm using a PowerShell script and WinSCP to upload a file onto an SFTP site, Root\Users\SFTPSite and it's placing the directory onto the SFTP site that I'm uploading from. So instead of putting it on Root\Users\SFTPSite it's putting it into…
user12848565
2
votes
1 answer

Can you embed the private key into a PowerShell WinSCP script?

Can you embed the private key into a PowerShell WinSCP script instead of calling for the .ppk file? Maybe something like this? # Load WinSCP .NET assembly Add-Type -Path "WinSCPnet.dll" # Set up session options $sessionOptions = New-Object…
jordand83
  • 31
  • 4
2
votes
1 answer

FluentFTP and TLS connection to IIS fails with error 534

We currently use WinSCP C# library to connect to an FTP site using TLS. It works perfectly, but we are moving to Linux containers and WinSCP won't work. I've been trying to replicate the functionality using FluentFTP but with out success so far, the…
DanSharpe
  • 41
  • 2
  • 7
2
votes
1 answer

Download only new files with WinSCP in PowerShell

How could I download the latest files, or files that were posted a certain amount of days? Importing a CSV file that contains a Source and a Destination column. Needs to check, if the path exists/file exists and only download new files. Script…
user 9191
  • 717
  • 4
  • 11
  • 31
2
votes
2 answers

WinSCP Timeout waiting for WinSCP to respond

WinSCP version used 5.13.3 I have a PowerShell script that does sftp files to a remote server. Intermittently I get: Timeout waiting for WinSCP to respond Tried setting SessionOptions.Timeout property, which did not help either ...any…
Chethan M
  • 121
  • 1
  • 1
  • 10
2
votes
1 answer

Download all files except a specific folder from FTP server using WinSCP .NET assembly

So far this is the code I'm using to get the All items inside of a folder but inside of this folder, has a sub folder i don't want to include in downloading, is there a way to not include that folder ? session.GetFiles("/*.*", @"D:\Download\",…
Bap mop
  • 320
  • 2
  • 15
2
votes
2 answers

PowerShell script to copy files but not subfolders to SFTP and move to subfolder once done

I am using the following script to copy files from my local folder to SFTP. Once I upload the file I then want to move the file to a subfolder. I want to upload only files in the C:\Users\Administrator\Desktop\ftp folder, and not files in the other…
Site
  • 145
  • 1
  • 11