UDM - IBM i Wild Cards


IBM i Wild Cards

In source file specifications in the LIB file system for the delete command and for the copy command and file specifications for the forfiles statement, wildcards can appear in the library, file, and/or member portions.

An asterisk ( * ) represents a match of zero or more characters. A question mark ( ? ) represents a match of exactly one character,

Wildcards only apply to the library, file or member portion of the fully qualified file name in which they appear.


For example, in the statement:

COPY SRC=ABC/DEF*

The wildcard only applies to the file portion of the name and an error will result because the user did not provide a member name.


To copy all of the files that begin with DEF, along with all of their members from library ABC, use the format:

COPY SRC=ABC/DEF*(*)



Likewise, to copy all of the files and their members in libraries that begin with ABC, use the format:

COPY SRC=ABC*/*(*)



In destination file specifications, wild cards are not allowed.

Examples

COPY SRC=ABC*/DEF*


Copies all files beginning with DEF from all libraries beginning with ABC.


COPY SRC=ABC/DEF(*)


Copies all the members in the physical file DEF in the library ABC.
 


DELETE SRC=MYLIB/MYFILE?


Deletes all files in the library MYLIB starting with MYFILE and containing one additional character.


FORFILES SRC=*/*(*)


Lists all members in all files in all libraries.