Hello all friends , i'm biginner in scripting , i just wanted to send i folder to a distant machine ising scp , without writing the password of the distant machine in terminal .For that , i found a script which is :
#!/usr/bin/expect -f # effectue le transfert par SCP (sur SSH) set timeout 3600 set localfile [lindex $argv 0] set distfile [lindex $argv 1] set servername [lindex $argv 2] set password [lindex $argv 3] spawn scp -r $localfile $servername:$distfile expect "password:" send -- "$password\r" expect "100%" exit 0
that receive arguments , this works nice ,send the folder ,without asking password (i passed it as argument from a python code), but i can't found all the files that was inside the folder in local machine in the new folder on the distant one .Maybe , the connexion ends when there 100% or maybe the connexion ends before that the copy is finished !!! and when i execute the comand :
scp -r /home/user/Bureau/SaveProg/ firstname.lastname@example.org:/home/distuser/Bureau/
it send the folder and it under-folders as well and all files .. Can some one have ideas please .