• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 263
  • Last Modified:

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.
0
parpaa
Asked:
parpaa
  • 3
  • 2
2 Solutions
 
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?
0
 
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
0
 
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
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
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).
0
 
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?
0
 
parpaaAuthor Commented:
Ozo :: I was so stupid-- my bad.

It is working with sftp command. Thanks anyways closing this ticket out :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now