Praveen
Praveen

Reputation: 39

Shell Script to copy files from linux machine to windows machine

I would like to copy a file from Linux machine to Windows machine periodically (both the machines are accessed remotely).

Suppose I have the following. Linux machine named host1 and the username is user1 Windows machine named host2 and the username is user2. The windows machine also has the password to logged in.

I want to copy files from /home/admin of host1 to D:\admin of host2.

Can anyone please help me in creating a shell script to perform this task.

Upvotes: 0

Views: 13149

Answers (1)

danglingpointer
danglingpointer

Reputation: 4920

One way to copy files from one machine to other is using SCP utility.

scp username@host_ip:/home/user/your_file /cygdrive/D/admin/

Copy the file "foobar.txt" from a remote host to the local host

scp [email protected]:foobar.txt /cygdrive/D/admin

Simple generic command.

Copy the file to the /home/project/ directory on your device. Note: provide IP is just an example.

scp youfile.txt [email protected]:project/

I suggest you check this SCP commands.

Upvotes: 1

Related Questions