I have to run a few commands of WinSCP from a Python class using subprocess.
The goal is to connect a local Windows machine and a Windows server with no FTP installed and download some files. This is what I tried
python
proc = subprocess.Popen(['WinSCP.exe', '/console', '/WAIT', user:password@ip:folder , '/WAIT','get' ,'*.txt'], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
With this I get it to open the WinSCP console and connect to the server, but it doesn't execute the get
command. Is the problem because the get
is executed on the Windows console and not in the WinSCP console?
I also tried replacing winscp.exe /console
for winscp.com /command
.
Is there any way to do this?