downloading a folder

I know how to download a file from a ftp server through shell script.
But when there is a folder inside the directory you are in, I could not
download them.

How would you write it?

I can think of this.
login to ftp and output the directory tree into a file.
Log out the session
read the output and let the variable to store the folder path
log in to ftp again and cd to that directory
and download files inside this folder.

I think this is cumbersome and not really smart, is there any better ways to do this?

maybe, the command that you use have an option like "-r" or "-R" in the meaning of recursive