Source and Destination Patterns
When wildcards are used during copy and rename operations, a pattern must be provided for both the source and the destination. The destination pattern must always conform to the source pattern in that the number and order of wildcard characters must be exactly the same between the two. For example, the patterns,
which conform to each other, while these patterns do not:
When using wildcards, the new destination name is formed by replacing each wildcard in the destination pattern by the characters from the source name that matched the corresponding wildcard in the source pattern. This allows you to both add and remove characters from the source name during the copy or rename process. Some examples should make this clear:
| | | |
*_base | *_jan | x_base | x_jan |
us_* | * | us_gdp | gdp |
x? | x?f | x1 | x1f |
*_* | **f | us_gdp | usgdpf |
??*f | ??_* | usgdpf | us_gdp |
Note, as shown in the second example, that a simple asterisk for the destination pattern will result in characters being removed from the source name when forming the destination name. To copy objects between containers preserving the existing name, either repeat the source pattern as the destination pattern,
copy x* db1::x*
or omit the destination pattern entirely,
copy x* db1::