sftp script

Hi ,

I am new to unix, I was planning to write a simple sftp test that will transfer file from one folder to another folder, letassume it will pick all the .txt files from one folder location /home/dirA to /home/dirB, plz guide me what will be the script like..? :confused:

There are hundreds or thousands of threads here about this, and one or more new ones almost every day. Please use search.

sftp username@host <<EOF
lcd /home/dirA
cd /home/dirB
mput *.txt
exit
EOF

If you want it to connect passwordlessly, see passwordless ssh.

1 Like