Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: DOWNLOADING MULTIPLE FILES FROM FTP SERVER WITHOUT ANY PROMPT  (Read 3800 times)

0 Members and 1 Guest are viewing this topic.

Harisankar

  • Guest
*************************************************************************************

Normally when we try to connect to a FTP server we can download one file after other but if we want to download multiple files at a time we can use mget at FTP prompt but the issue is it always asks you to conform your action by presenting you with yes/no prompt for which we have to either enter "Yes" or "No". This is not advisable when you want to script your actions like keeping in a shell script.


We can resolve this issue in two ways........

---------
1.  When you are accessing FTP server use -i option which is nothing but interactive way to get files from FTP server, actually this -i option will disable iteractive download of files from server.

 Syntax:
ftp -i server-ip/servername

Example:

#ftp -i 222.1.89.1
----------

----------
2. This is used when you are middle of the transaction you can use prompt command in ftp mode to get multiple files with out any prompt, here is the example and this is for that session
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-r–r– 1 1005 0 47 Apr 11 19:37 file1.txt
-rw-r–r– 1 1005 0 47 Apr 11 19:37 file2.txt
-rw-r–r– 1 1005 0 47 Apr 11 19:37 file3.txt
-rw-r–r– 1 1005 0 47 Apr 11 19:37 file4.txt
226 Directory send OK.

ftp> prompt
Interactive mode off.

ftp> mget *
local: file1.txt remote: file1.txt
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for file1.txt (47 bytes).
226 File send OK.
47 bytes received in 0.00 secs (72.1 kB/s)
local: file2.txt remote: file2.txt
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for file2.txt (47 bytes).
226 File send OK.
47 bytes received in 0.00 secs (88.3 kB/s)
local: file3.txt remote: file3.txt
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for file3.txt (47 bytes).
226 File send OK.
47 bytes received in 0.00 secs (136.2 kB/s)
local: file4.txt remote: file4.txt
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for file4.txt (47 bytes).
226 File send OK.
47 bytes received in 0.00 secs (136.6 kB/s

*************************************************************************************************