Link to home
Start Free TrialLog in
Avatar of ambuli
ambuliFlag for United States of America

asked on

How to write a batch file

Hi Experts,

I have a windows batch file which actually uses winscp to upload some files to a Linux server.  I want to do the same thing from a Linux machine to another Linux machine.

option batch on
option confirm off
option transfer binary

open root:default@100.200.100.200

cd /myDir
put C:\Ambuli\my.jar
put C:\Ambuli\lib\*.jar

close
exit
Avatar of ambuli
ambuli
Flag of United States of America image

ASKER

I wrote a simple script like this.
scp root@10.37.202.100:~/Ambuli/test  ~/ambulie/

and it works, but how can I enhance this so that I can copy multiple files.

Avatar of amit_g
Depends how multiple files are defined...

scp root@10.37.202.100:~/Ambuli/test root@10.37.202.100:~/Ambuli/anotherfile ~/ambulie/

would copy both test and anotherfile to ~/ambulie/
Avatar of ambuli

ASKER

Hi amit_g
The problem with this is that I have to type the password again and again.  
ASKER CERTIFIED SOLUTION
Avatar of Cyclops3590
Cyclops3590
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
just noticed I messed up this line
scp root@<each server>:~/.ssh/authorized_keys2

it should be

scp ~/.ssh/id_rsa.pub root@<each server>:~/.ssh/authorized_keys2
sorry for any confusion