Answer the question
In order to leave comments, you need to log in
How to copy a file from windows to ubuntu with a non-ssh script?
There is a local ubuntu and a remote Windows.
Winrm works on Windows and like this:
https://github.com/diyan/pywinrm
What should I write in powershell or shell script to copy
C:\1.txt to /home/test/Downloads/1.txt?
Thank you!
Answer the question
In order to leave comments, you need to log in
Sorry, I'll answer myself.
Everything is decided by samba and shared disk space for Windows and Ubuntu.
pywinrm doesn't copy files, it executes remote commands.
You need to transfer files either in three generally accepted ways:
ssh (scp, rsync)
ftp
samba
Or write your own bicycle service for transferring files.
As an option, you can try some cloud services, such as googledrive, for which there are clients for both Linux and Windows.
Well, you can try to upload the file via http
$uri = "http://blahblah.com"
$imagePath = "c:/justarandompic.jpg"
$upload= Invoke-RestMethod -Uri $uri -Method Post -InFile $imagePath -ContentType 'multipart/form-data'
you can install python on Windows, run the python webserver in the folder where the desired file is located, and from ubunta make wget http://windows_ip:port/1.txt.
seems to be for python up to ver. 3 command will be:
python -m SimpleHTTPServer port
after ver. 3:
python -m http.server port
is if you need to copy the file at once. if you need a long-term solution, I would look towards samba or SCP or FTP.
ps nasty parser!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question