I'm facing issues in executing the bash script of mine. This script will pick the latest file received and connects SFTP server and files is placed on this remote server.
Error message
Enter password:
"File movement"
sftp> cd Test
sftp> put Test_File_201309.txt
File "Test_File_201309.txt" not found.
Portion of Code
cd /somefolder/$folder_name
file1_To_Copy=`ls -tr *"$keyword1"*."$ftype" | tail -n 1`
if [[ condition1 == condition2 ]]
then
echo "File movement"
sftp host@abc.com <<EOF
cd Test
put ${file1_To_Copy}
EOF
fi
Check that your sftp is in the local directory you think it is ( lpwd )* and that the file does exist ( lls ). Also check you don't have any whitespace in the filename.
it should be in the current working directory, but I forget if you can configure sftp to start somewhere else by default.
Thank you so much for your response, Unfortunately bash scripting is very new to me. I dont know how to do the checks which you asked me to do We dont have any whitespaces in file name