I have created one script to copy the local files to the remote folder. The script is working fine outside of if
condition. But when I enclosed inside the if
condition the put
command is not working. It logged into the remote server using SFTP protocol and when exist it's showing the error:
put command not found
See what is happening after executing the script:
Connected to 10.42.255.209.
sftp> bye
sftp.sh: line 23: put: command not found
Please find the below script.
echo -e;
echo -e "This script is used to copy the files";
sleep 2;
localpath=/home/localpath/sftp
remotepath=/home/destination/sftp/
if [ -d $localpath ]
then
echo -e "Source Path found"
echo -e "Reading source path"
echo -e "Uploading the files"
sleep 2;
sftp [email protected]
put $localpath/* $remotepath
else
scp
...:scp localpath [email protected]:/remote/path/
– Stickybeaksftp [email protected] <<< "put $localpath/* $remotepath"
? – Indulgent