Link to home
Start Free TrialLog in
Avatar of parpaa
parpaa

asked on

File not found - Bash Script

Hi experts,

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.

Open in new window



Sample 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

Open in new window


Hope am clear with my requirements. Any help is greatly appreciated

Thank you
Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

Try removing that "cd Test" line.
Avatar of parpaa
parpaa

ASKER

Hi gerwinjansen

I tried removing cd Test but no luck :(
ASKER CERTIFIED SOLUTION
Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of parpaa

ASKER

Hi gerwinjansen,

Apologies, the file was not present in the local working directory - Hence it was file was not found. Thank you so looking into this issue.

It has been resolved.
thank you
Avatar of parpaa

ASKER

thank you for your help
You're welcome ;)