MGET (Copy Multiple Files from a Remote System to the Local System)

The MGET IBM® i FTP client subcommand copies multiple files from the remote system.

FTP client subcommand

How MGET transfers files:

When you enter the MGET subcommand, a separate GET subcommand is run for each remote file that you want to transfer. The FTP server creates the name of the corresponding local file automatically as determined by the default naming rules.

The MGET FTP client subcommand uses the following process to determine where to put files.

  • The MGET subcommand always places files in the current library or directory.
  • If the user has issued the LCD subcommand, the FTP server uses this library or directory.
  • If the user has not issued the LCD subcommand, the FTP server sets the current directory as follows
    • If the user's job has a current library set, this library is the current directory for FTP.
    • If the user's job does not have a current library set, the FTP server uses QGPL as the current directory.

MGet {remotefile
[remotefile...]}[(Replace]

remotefile
The file or files you want to retrieve from the remote system.
( Replace
Overwrites an existing file on your local system. If the file already exists on your local system and you do not use the Replace option, the existing file is not overwritten. The name of the local file where the remotefile is copied is created automatically.

You can use an asterisk (*) to copy all members in a file to your current library or directory. For example, if the remote system is a IBM i product, the following examples apply:

  • MGET MYLIB/MYFILE. * copies all the members of file MYFILE in library MYLIB on the remote system to your current library on the local system.
  • MGET /QSYS.LIB/MYLIB.LIB/MYFILE.FILE/ * .MBR would be the NAMEFMT 1 version of this command.
  • MGET /QOPT/PICTURES/IMAGES/. * copies all the files of directory IMAGES from optical volume PICTURES to your current library (or directory) on the local system.
  • MGET TESTFILE.A * copies all members that start with the letter A in file TESTFILE.
  • MGET /QDLS/QISSOS2/A * copies all documents that start with the letter A in folder QISSOS2.