Modify Shell script

Hi Experts
I need to modify my existing bash script -  use FTP connection instead of SFTP. What changes should I make to modify my existing script?

Existing Code::
if [[ "${date1}" > "${date2}" ]]
then
echo "file movement";

sftp username@host <<EOF
cd Test
put ${fileToCopy}
EOF
else
echo "do Nothing"
fi

Open in new window


If I replace SFTP keyword with FTP will that work?
Hope am clear with my requirement. Thank you so much in advance.
parpaaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozoCommented:
Does your system have ftp? Is it in your path?  Does host have an ftp server?
Did you get any errors when you tried your script with ftp?
parpaaAuthor Commented:
My system does not have FTP and am connecting to client's remote FTP server
and path /Test folder - I want to copy files to this folder. I havnt tried it since i am not sure with correct syntx.

I tried connecting SFTP with above code and it works perfectly . It connects to this SFTP srever and places the file.

Let me know if you have any more questions
parpaaAuthor Commented:
scp  $FileToCopy user@FTPHost.com:/Test

Open in new window

When I tried executing this it asks me passcode- after I enter it nothng happens. Its all blank
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

simon3270Commented:
If the remote server is a pure FTP server, it won't understand the secure protocols used by scp and sftp.

You will need to install an FTP client on your machine.  Assuming that the command you have installed is "ftp" and it is in your shell's PATH, you can simply replace "sftp" with "ftp" (since the "cd" and "put" commands you use are also supported by ftp).
ozoCommented:
If your system does not have ftp, then you won't be able to run it on your system.
You could install ftp, but if it works perfectly with sftp, why do you want to change it?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
parpaaAuthor Commented:
Ozo :: I was so stupid-- my bad.

It is working with sftp command. Thanks anyways closing this ticket out :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.