Need SCP script equivalent to FTP script .

Hi,

Currently i'm using the folllowing FTP acript and its working.

echo "open $server" > ftp_file
echo "user $user $password" >> ftp_file
echo "cd $remote_dir" >> ftp_file
echo "lcd $local_dir" >> ftp_file
echo "put $file">> ftp_file
echo "bye" >> ftp_file
ftp -nv < ftp_file

I've been asked to replace ftp script with scp or any other file transfer methods.
I've tried scp method , but its prompting for password. i'm not not able to hardcode password in script. Please help me in this regard.

Thanks.

If you are allowed, you can do an ssh key exchange for a user. Then you will not be prompted for a password, but scp does not use the same command syntax as ftp. sftp uses a similar one to ftp but both would benefit from a key exchange.