Automate SCP with multiple files with a wait script

So, I saw a few posts about this, and maybe I just didn't see the right one.

I use a wait script to scp multiple files from my locale to remote. I don’t want to configure the keys for entering the system without a password, because then the servers cannot be blown up and do not work anymore, yes, I could automate the creation of the keys, I would just not want to. So I want to be able to use *, but every time I use *, it tells me. The reason I want to use * instead of the full name is because the version number will change, and I don’t want to manually change the script every time.

/path/{Install.sh,programWithVerionAfter*\}: No such file or directory Killed by signal 1. 

I hope this is a simple fix or workaround. All I would like to do is scp these files so that I can automate the installation process with the click of a button. Thank you in advance for any help.

 #!/usr/bin/expect -f spawn scp /path/\{Install.sh,programWithVerionAfter*\} " root@IP :/tmp/. expect { -re ".*es.*o.*" { exp_send "yes\r" exp_continue } -re ".*sword.*" { exp_send "Password\r" } } interact 
+5
source share
2 answers

I found what I wanted with much more googleing. Thanks for your help, hope this helps others.

http://www.linuxquestions.org/questions/linux-general-1/scp-with-wildcard-in-expect-834813/

 #!/usr/bin/expect -f spawn bash -c "scp /path/* root@IP :/tmp/" expect { -re ".*es.*o.*" { exp_send "yes\r" exp_continue } -re ".*sword.*" { exp_send "Password\r" } } interact 
+12
source

You can use curl to copy files from the local host to your remote host via sftp (which is the same as copying with scp for all purposes and tasks) and specify the username and password in the command, for example

 curl -T /files/to/copy/* -u username:password ftps://ftpshost.domain.tld/ 
+1
source

Source: https://habr.com/ru/post/1202354/


All Articles