Upload (mput) and Download (mget) Multiple Files Automatically in FTP Transfer

FTP or File Transfer Protocol is a useful utility that allows you to transfer several files between a workstation or client with the FTP server. Although nowadays GUI FTP client programs such as WS-Ftp and FileZilla are very common, but DOS or command-line FTP interface comes in useful and handy as it’s free and especially when you don’t have Internet connection to download the advance FTP clients, as basic FTP functionalities are built-in into most operating system including Windows XP, Windows Vista, Windows 2003, Linux, Unix, FreeBSD and so on.

In DOS or command line FTP, to transfer several files, you can use the commands mput (Multiple PUT) and mget (Multiple GET). These commands work exactly like put and get except the commands allow you to transfer multiple files in a single command by specifying the files that you want to transfer with wildcards such as * to get all files.

However, mget and mput will prompt user to choose Yes or No before each file is tranfered to or from the server. It’s troublesome and time wasting if you have to upload or download a lot of files as you have to attend and pay attention to the FTP process and press Y for each and every file.

To avoid the situation and automatically transfer the files so that the FTP session can process unattended, use the prompt command before using the mput or mget commands. The prompt command toggles between prompting on, where ftp will prompt you to choose yes or no before each file is transfered, and prompting off, which will copy all files without prompting. By default, prompting is on. So to continue to FTP transfer all files without asking, remember to issue prompt command before starting the transfer process. Ask it do not prompt before putting or getting the files, make sure that your existing files do have have the same file name as FTP will overwrite the existing files that exists on the destination directory automatically too. The command is simple, just a single word “prompt”:

ftp> prompt

Interactive mode off.

FTP command line utility should return Interactive mode off, which is FTP will no longer prompting for instruction from users (prompting off) and will always assumes Yes to whatever actions, in case is get or put the file or overwriting. If key in prompt again will turn prompting on. With prompting on, however, you can easily terminate the FTP file transfer session if the transfer might not work or might take too long by pressing Ctrl-C (^c or press and hold the Control and C keys simultaneously). FTP utility will ask:

Continue with mput?.

Responding with the character n (for No) will stop the transfer process.

15 Responses to “Upload (mput) and Download (mget) Multiple Files Automatically in FTP Transfer”

  1. Mike Kelly
    December 5th, 2009 04:50
    15

    I used the wscript.sleep to delay for completion.

  2. Santhana
    August 25th, 2009 19:18
    14

    we can use runique OPTION in ftp.

    runique Toggle storing of files on the local system with unique
    filenames. If a file already exists with a name equal to
    the target local filename for a get or mget command, a .1 is
    appended to the name. If the resulting name matches another
    existing file, a .2 is appended to the original name. If
    this process continues up to .99, an error message is
    printed, and the transfer does not take place. ftp reports
    the unique filename. Note that runique does not affect
    local files generated from a shell command (see below). The
    default value is off.

  3. Santhana
    August 25th, 2009 18:25
    13

    how to download multiple file without replaceing existing files using mget command

  4. Shyam
    August 20th, 2009 05:54
    12

    thanks a lot.

    ftp> prompt

    Interactive mode off.

    This command is very much useful command to get the bulk load.

    To turn the prompting on… use it again.

    ftp> prompt
    Interactive mode on.
    ftp>

  5. ksamy
    June 26th, 2009 19:06
    11

    how to download multiple file without replaceing existing files using mget command

  6. Harish Maliwal
    June 25th, 2009 17:04
    10

    really helpful …

    thanks.

  7. Jerry
    June 4th, 2009 21:23
    9

    Lovely Hurling

  8. christer
    May 9th, 2009 10:42
    8

    Just what I needed
    Thanks much :)

  9. Reniery
    February 27th, 2009 02:34
    7

    thanks a lot for the article, was very helpful

  10. Alberto
    July 21st, 2008 03:54
    6

    I love you. I had to move over 5000 files and I was doing like Homer Simpson with the bird pressing the “Y” button automatically.

    Thank you.

  11. John
    July 12th, 2008 01:12
    5

    Thank you for the ‘prompt’ tip to turn off prompting.
    Extremenly helpful.

  12. prabhjot
    February 4th, 2008 23:49
    4

    saved time, thanks alot for mput explanation.

  13. neXus
    January 19th, 2008 04:21
    3

    thanks :)

  14. henry
    May 31st, 2007 10:50
    2

    Thanks for the ‘prompt’ tip to turn off prompting.

  15. Rolf Aske
    May 8th, 2007 02:27
    1

    I found this article very helpful. I have one problem doing the “mget” and that is that the script goes to “disconnect” and “bye” before the ftp been completed. How do I handle this? Thank you.

    objMyFile.WriteLine (”prompt”)
    objMyFile.WriteLine (”mput ” & strFilePut)
    objMyFile.WriteLine (”disconnect”)
    objMyFile.WriteLine (”bye”)
    objMyFile.Close

    Set objFSO = Nothing
    Set objMyFile = Nothing

    ‘Run ftp script
    Set objShell = WScript.CreateObject( “WScript.Shell” )
    objShell.Run (”ftp -s:” & chr(34) & strFTPScriptFileName & chr(34))
    Set objShell = Nothing

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to comments feature has been disabled. To receive notification of latest comments posted, subscribe to My Digital Life Comments RSS feed or register to receive new comments in daily email digest.

New Articles

Incoming Search Terms for the Article

ftp mget no prompt - mget no prompt - FTP mput - mput - mput no prompt - ftp mput no prompt - mget without prompt - mput ftp - mget - mput without prompt - ftp put multiple files - mget * - ftp mput yes - mget options no prompt - mget all - mget force yes - ftp commands mget no prompt - mput ftp no prompt - mget prompt - ftp mput without prompt - windows ftp mput - ftp mput overwrite - how to download multiple files from ftp - mget ftp no prompt - ftp mget without prompt - mget *.* - mput yes to all - mget command without prompt - ftp mget - ftp mget all - mput - mget mput - dos ftp mput - mget yes to all - mget ftp yes to all - ftp upload multiple files - mput without asking - ftp transfer multiple files - ftp put overwrite - mput multiple files - ftp mget digital life - mput ftp all files - ftp mget options no prompt - ftp no prompt mget - ftp mget yes to all - mget prompt off - filezilla mget - ftp script mget - ftp mget prompt - mget all files without prompt -