Need help with a .sh script

Hi. I'm trying to copy file from my pc to a vps server.
I thought about .sh script:

  1. ./copy.sh thing1 path/on/my/pc/something.jar
    It should upload something.jar from my pc to /home/meh1 /home/meh2 and /home/meh3 (these 3 paths are located on vps)
    .
  2. ./copy.sh thing2 path/on/my/pc/something.jar
    It should copy something.jar from my pc to /home/huh (only 1 path and located on vps)
    .
  3. ./copy.sh thing3 path/on/my/pc/something.jar
    It should copy something.jar from my pc to /home/pizza (only 1 path and located on vps)

_______
Thanks for advices :slight_smile:

What shell does the VPS use? bash?
Assuming several things you did not mention, I am guessing the VPS disk is not mounted on your PC as some disk named like D:

You can probably use ftp to copy, you can also get puTTy, pscp for your PC free.
See: http://www.putty.org/

pscp is your best choice. It works like the cp command in UNIX or the copy command in windows. You run it on your PC.

So, what I am saying: you need other stuff on your PC to do what you want. You cannot run things on the VPS without FIRST allowing windows a way to talk to the VPS. This is by far the least complicated.

Im using arch Linux on my pc and Debian on vps :wink: I also know what the putty is... I've asked for help with .sh script which im gonna launch on my pc in order to send these files faster.

How about scp?

scp localfile username@host:/path/to/localfile

If that's not enough, you'll need to make your question more specific. Right now we've got nothing to go with.

1 Like

Well as far as i know it would ask me for a password many times + i can't use it in .sh. Or am I wrong?

You can use it in sh, and there are ways to set up a key file in advance to prevent it asking for a password. Its the exact same problem - and protocol - as passwordless ssh.

SSH login without password

You can copy more than one file per scp, by the way.

scp file1 file2 file3 file4 username@host:/path/to/destination
1 Like