import sys,os
import pexpect

source_file= 'sourcefile.txt'

user='username'

ip='00.00.00.00'
desti_path='/home/jai/………'
password='bond007'





cmd ='scp'+' '+source_file+' '+user+'@'+ip+':'+desti_path

        try:

                foo = pexpect.spawn(cmd)

                foo.expect('.ssword:*')

                foo.sendline(passwd)

                foo.sendline('Passwd_to_server')

                foo.interact()

        except Exception,e:
                pass

Its simple, this should work, it works for me
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to