Reputation: 205
Jenkins is running on windows machine and I am trying to copy files from windows to unix as a build step.
SSH sever details has been configured in the global configuration and connected successfully.
kindly share the Exec command to copy files from windows to unix
Upvotes: 1
Views: 11540
Reputation: 89
To copy files using PuTTY or any unix shell powered with SSH from windows, run this command.
scp /path/to/file.ext [email protected]:/Destiny/path
To run commands in your remote computer just connect to it with:
ssh [email protected]
Customize the user, the IP and authenticate with the properly password.
Upvotes: 0
Reputation: 2691
There is a Jenkins plugin that might fit your needs:
https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over+SSH+Plugin
It uses Java SSH library so no need to install another SSH client.
Upvotes: 1
Reputation: 309
You need some kind of ssh client on your windows. I suggest Winscp, which is simple, easy and fast. Winscp is a GUI application but as you want to run something from Jenkins you need to have a command line tool. Good news is that you can run Winscp in command line. Then the following steps should answer your question:
Install Winscp on the Windows machine.
Add your Winscp installation path (sth like C:\Program Files (x86)\WinSCP) to your system environment path variable
The command below will copy the file, you should read winscp manual for more details:
winscp root:password@UNIX_MACHINE_IP /command "put c:/PATH_TO_FILE_ON_WINDOWS /home/PATH_TO_TARGET_ON_UNIX"
Upvotes: 1