0

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/ distuser@10.100.8.22:/home/distuser/Bureau/

it send the folder and it under-folders as well and all files .. Can some one have ideas please .

1
Contributor
1
Reply
3
Views
5 Years
Discussion Span
Last Post by Ismatus3
0

Hello , It's solved , the problem was : the script was created for sending a file , but in the case of a folder , with the options of scp :

-r -c blowfish

, it stops evrytime it finds "100%" , in the line :

expect "100%"

, and this don't let the other files to be sent .

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.