The first choice is to install a GUI FTP client tool to drag and drop a directory to achieve your work. The tool will retrieves all files under the directory for you. One of famous FTP GUI tools is Filezilla that is very easy to use.
But sometimes, you are not allowed to install any GUI tools or script-based utilities like "lftp" to facilitate you to do it, there's only a very basic ftp for you to use. Even though, we can also get the same result in a indirect way, which is as simple as possible.
- Zip you directory recursively on server side.
- Connect as a FTP client to get the zip file.
- Unzip the zip file in client side. You can unzip the file by any tool as you like. Now, we're done.
$ cd ~/Workspace
$ zip -r 20110408.zip AllScripts
adding: AllScripts/ (stored 0%)
adding: AllScripts/Scripts14.sh (deflated 73%)
adding: AllScripts/Scripts27.sh (deflated 79%)
adding: AllScripts/Scripts38.sh (deflated 76%)
D:> ftp ftp.example.com
Connected to ftp.example.com.
220 orcl FTP server ready.
User (ftp.example.com:(none)): oracle
331 Password required for oracle.
230 User oracle logged in.
ftp> cd /home/oracle/Workspace
250 CWD command successful.
200 Type set to I.
ftp> get 20110408.zip
200 PORT command successful.
150 Binary data connection for 20110408.zip (435234551 bytes).
226 Binary Transfer complete.
ftp: 435234551 bytes received in 76.88Seconds 5528.2Kbytes/sec.
Note that, we set the transportation mode to binary to get a correct copy.
If you get the zip file with ASCII mode (the default mode) in FTP, you will get error like this when unzipping the file:
Unzip failed because the file downloaded in ASCII mode.
How to Use LFTP over SFTP Protocol