MDelete subcommand—Delete multiple files
Purpose
Use the MDelete subcommand to delete multiple files.
Format
Parameters
- foreign_file
- Specifies the name of the file to be deleted on the remote host.
Because more than one file can be deleted with the MDelete subcommand, the foreign_file parameter of the MDelete subcommand can be repeated many times, with each foreign_file separated by a blank space.
Results:
- If the LISTSUBdir option is not specified on the SITE subcommand and the LISTSUBDIR statement is not specified in the server FTP.DATA file, the default is as if LISTSUBdir option was specified on the SITE subcommand.
- If the z/OS® FTP server has the NOLISTSUBdir option on the SITE subcommand or LISTSUBDIR FALSE in the server FTP.DATA file, an MDelete * deletes only the files in the current directory.
Restriction: The LISTSUBdir
option applies to z/OS UNIX file operations only; MVS™ data set operations are not affected.
Examples
Example 1: Following is
a sample entry and the response that displays after using the MDelete
subcommand for multiple z/OS UNIX files.
cd '/u/user121/ftp.example'
>>>CWD '/u/user121/ftp.example'
250 HFS directory /u/user121/ftp.example is the current working directory
Command:
mdelete file1 file2 file3
>>>PORT 9,67,112,25,4,75
200 Port request OK.
>>>NLST file1
125 List started OK
250 List completed successfully.
>>>PORT 9,67,112,25,4,77
200 Port request OK.
>>>NLST file2
125 List started OK
250 List completed successfully.
>>>PORT 9,67,112,25,4,76
200 Port request OK.
>>>NLST file3
125 List started OK
250 List completed successfully.
>>>DELE file1
250 /u/user121/ftp.example/file1 deleted.
>>>DELE file2
250 /u/user121/ftp.example/file2 deleted.
>>>DELE file3
250 /u/user121/ftp.example/file3 deleted.
Command:
Example 2: MDelete * with SITE LISTSUBdir
Following is an example of MDelete * with the SITE LISTSUBdir
option. This setting affects processing of the NLST command. The z/OS FTP client sends an NLST command
to the server as part of MDelete * subcommand processing. The LISTSUBdir
option specifies that both the current and the next subdirectory should
be deleted as a result of processing an MDelete * subcommand. In
this example, the current directory has a file x and a subdirectory
y and subdirectory y has a file x.
site listsubdir
>>> SITE listsubdir
200 SITE command was accepted
prompt
Interactive mode is off
Command:
mdelete *
>>> PORT 127,0,0,1,4,15
200 Port request OK.
>>> NLST *
125 List started OK
250 List completed successfully.
>>> DELE x
250 /tmp/mgetmput/x deleted.
>>> DELE y/x
250 /tmp/mgetmput/y/x deleted.
Command:
Example 3: MDelete * with SITE NOLISTSUBdir
Following is an example of MDelete * with the SITE NOLISTSUBdir
option. This setting affects processing of the NLST command. The z/OS FTP client sends an NLST command
to the server as part of MDelete * subcommand processing. The NOLISTSUBdir
option specifies that only the current directory should be deleted
as a result of processing an MDelete * subcommand. In this example,
the current directory has a file x and a subdirectory y and subdirectory
y has a file x.
site Nolistsubdir
>>> SITE Nolistsubdir
200 SITE command was accepted
prompt
Interactive mode is off
Command:
mdelete *
>>> PORT 127,0,0,1,4,15
200 Port request OK.
>>> NLST *
125 List started OK
250 List completed successfully.
>>> DELE x
250 /tmp/mgetmput/x deleted.
Command:
Usage
- If you specify one or more incorrect foreign files with the MDelete subcommand, an error message specifying the incorrect foreign file is displayed. All correct foreign files are deleted, regardless of any incorrect foreign files, and the MDelete subcommand does not need to be reissued for these files.
- z/OS UNIX file names require special handling for certain special characters. All special characters that the operating system requires to be preceded by an escape character in commands issued to the shell must be preceded by the backslash (\) escape character, except for the single quote (’), double quote (”), or blank ( ).
Context
See Specifying data sets and files for more information about naming conventions.