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

»»»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.

Update: More ways to skip prompting when transferring multiple files in FTP.

By | 2016-12-09T08:42:11+00:00 December 9th, 2016|Categories: Developer Tools|26 Comments

About the Author:

LK is a technology writer for Tech Journey with background of system and network administrator. He has be documenting his experiences in digital and technology world for over 15 years. Connect with LK through Tech Journey on Facebook, Twitter or Google+.

STAY IN TOUCH

close-link