Closed labarp1111 closed 3 years ago
Yes, it's in the examples
Unless you want something more specific?
I actually tried this example but it is not working in our environment because the SFTP user IDs do not have a shell associated with them. I think to connect over SSH we will require a Shell to be associated with the user. As such, was trying to find out if we can connect over SFTP and run these commands.
I wonder if you're having any specific issues with cd/ls/pwd etc?
Maybe it's related to RemotePathTransformation? https://github.com/sshnet/SSH.NET/wiki/ScpClient:-Remote-path-transformation and I just need to add that option?
Although it is for SCP, not SFTP which I've not added yet.
using (var client = new ScpClient("HOST", 22, "USER", "PWD"))
{
client.RemotePathTransformation = RemotePathTransformation.ShellQuote;
client.Connect();
...
}
But generally there is $sftpClient.ChangeDirectory('test1') to cd into specific dir. There is $SftpClient.CreateDirectory, DeleteDirectory and so on, just I've not added it.
We are trying to transfer files to an SFTP server running on Mainframe. After we connect to the SFTP server, the first command that we need to run is "ls /+mode=text" which sets the type conversion on the Mainframe side (from ASCII to EBCDIC). So generally this is what we do when we connect from the Unix side- sftp userid@mainframe_IP ls /+mode=text cd DIR get * exit
We want to try something similar from PowerShell.
I don't see anything in the library that would help with that. Probably we would need to open a feature request in SSH.NET github and ask them if they have idea how to do it, and then we can try to translate it to powershell.
oh..ok. Thank you for checking on this.
Hi, is it possible to run SFTP commands such as "cd", "ls", "pwd", etc. (with custom parameters/arguments) through this module? We have a SFTP server where we want to run some of these commands.