Mput and Mget – upload and download multiple files in ftp transfer

Mput and Mget – upload and download multiple files in ftp transfer

FTP is mostly used utility for file transfer between server and client machine. We can download and upload files from anywhere using FTP service. There many FTP clients are available which can be used any GUI environment such as WS-Ftp and FileZilla for file transferring. But DOS or command line FTP utility, which includes in most of the operating systems (Unix, Linux, Windows, Mac), is very useful and handy.

In DOS or command line utility you can download and multiple files simultaneously using the Mput and Mget commands. Mput is similar to put command but the difference is put only upload single file from a deirectory but Mput can upload whole directory at a time.

Steps for uploading multiple files (MPUT):

1. cd to the directory whose content you want to upload.
2. log into the Ftp.
3. Cd to the directory where you want to upload the files.
4. Now use mput command. Below is the usage of mput command.

mput filename(s) – for multiple files
mput * — for complete directory

Steps for downloading multiple files (MGET):

1. Cd to the directory where you want to download the files.
2. Log into the FTP server.
3. cd to the directory whose content you want to download.
4. Now use mget command. Below is the usage of mput command.

mget filename(s) – for multiple files
mget * — for complete directory

However, mget and mput will prompt for confirmation when every time a file is transfered to and from the server. Its really irritating and time wasting process when you have to upload and download large number of files, because every time you need to press Y for yes.

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.

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.