Friday, May 3, 2013

Automating sftp command in unix


#!/bin/bash
/usr/bin/expect<<EOD
spawn sftp -o Port=<portnum> username@remoteserverhostname
expect "Password:"
send "remotehost passwd\n"
expect "sftp>"
send "put /home/folder1/txt1.txt  /home/remotefolder/txt1.txt \r"
expect "sftp>"
send "quit \r"




for more info on this see,
http://jibbysununix.blogspot.hk/2010/01/automating-sftp-with-expect-script.html



No comments:

Post a Comment