Validation to be added in the shell script

I need help with one of my shell script. The script is working fine but i need to add two condition -

i need to get rid of all the below ftp messages and need to have only ftp completed or failed message.
example when i run the script i get below lines -

Connected to xxxx

220 (vsFTPd 2.2.2)

331 Please specify the password.

230 Login successful.

250 Directory successfully changed.

257 "/path/to/1111111"

200 PORT command successful. Consider using PASV.

150 Ok to send data.

226 Transfer complete.

local: x.csv remote: x.csv

i have to check if mypath is present in ftp location. i tried using below if condition but was not succeeded.

ftp -inv $HOST <<-EOF

user $USER $PASSWORD

cd "$mypath"

if [[ $pwd = $mypath ]]

then

mput x.csv

echo "FTP completed"

fi

Below is my shell script -

!/bin/bash
echo "Enter if the env is dev or test or prod:"

while :

do

read -r INPUT_STRING

case $INPUT_STRING in

    test | TEST)

                            echo "Please enter the Model Group no : "

                            read -r input_variable

                            if [[ ${#input_variable} -ne "7" ]]

                            then

                            echo "Please check no given"

                            exit 1

                            fi

                            HOST=xxx

                            USER=xxx

                            PASSWORD=xxx


                            mypath="/path/to/$input_variable"

                            ftp -inv $HOST <<- EOF

                            user $USER $PASSWORD

                            cd "$mypath"

                            pwd

                            mput x.csv

                            EOF

                            exit 1
                            ;;
esac

done

You are in control of ftp 's verbosity. man ftp :

If you need more than ftp 's exit code for an error detection, I'd guess those messages are printed to stderr, so why don't you redirect stderr and analyse the log file?

To check for a remote path, you'll have to login and use shell commands. Why don't you just mkdir that path ignoring if it's there or not?