I am helping to support a series of somewhat complicated SFTP transfers. I've been nothing but impressed with the WinSCP .NET API – and have many successes already completed with various logins, checks, transfers, etc.
I'm not seeing anything current in the .NET API (
https://winscp.net/eng/docs/library_session#methods) that would support sending a block of commands back to the
scripting/console interface. Is this something that could be considered for inclusion?
I.e., this would allow for having some .NET framework classes, primarily responsible for creating the connection, authenticating, checking some assumptions, "work", and then closing the connection. (This has already solved some complexities that can't be done with the scripting/console interface.) However, this then needs to be called from another workflow program, which has already done some other processing (e.g. GPG-encrypting files, etc.) – and was already generating a script block, such as:
cd "dir1"
lcd "prod_dir1"
put "file1.txt"
put "file2.txt"
cd "dir2"
rm "file3.txt"
put "file3a.txt"
Is there a way that this could simply be called as the "work" from a .NET API? Such an API method would need to be named as to not be confused with the current
ExecuteCommand
- but could maybe be called
ConsoleCommand
or such? Even if it just accepted a single string to accept one line / command at a time – custom .NET code (outside of the WinSCP library) could then be written to read from a file, stream from STDIN, etc...
I found where the scripting / console interface is implemented at
https://github.com/winscp/winscp/blob/master/source/core/Script.cpp. I'm not sure what it would take to add a bridge to be able to call this from .NET API. Alternatively, I could look at writing a .NET class that would effectively read the same scripting / console commands – and translate them into its own calls to the other .NET API methods...
Thanks!!