UDM - Copying Multiple Files Using Wildcards or Regular Expressions
Introduction
In addition to copying single files, the copy command can be used to copy multiple files by using wildcards or regular expressions in the source file specification. If they are used, any file matching the source file specification will be copied.
Wildcards
Types of Wildcards
There are two types of wildcards:
- Asterisk (*) wildcard matches zero or more characters.
- Question mark (?) wildcard matches a single character.
Examples
Here are some examples of wildcard matching given the following file names in the source directory:
test.txt
test1.txt
test2.txt
test3.txt
test.bin
test1.bin
test2.bin
test3.bin
Source File Specification |
Files Copied |
---|---|
|
Matches and copies all of the files in the directory. |
|
Matches and copies the first four files. |
|
Matches and copies the last four files. |
|
Matches and copies files |
Regular Expressions
Types of Regular Expressions
POSIX Extended Regular Expression syntax is used for file name matching.
Examples
Here are some examples of regular expression matching given the following file names in the source directory:
test.txt
test1.txt
test2.txt
test3.txt
test.bin
test1.bin
test2.bin
test3.bin
Source File Specification |
Files Copied |
---|---|
|
Matches and copies all of the files in the directory. |
|
Matches and copies first four files. |
|
Matches and copes the last four files. |
|
Matches and copies the last three files. |
Usage
Wildcards and regular expressions can be used only in the source file specification, not the destination file specification.
Under some operating systems, it is possible for * and ? to be valid characters in a file name. When they appear in the destination portion of a UDM copy operation, they are treated as file characters and not as wild cards.
Also, keep in mind that while UDM can copy all of the files at a single directory level in a hierarchical file system, it will not traverse the directory tree and copy files from directories at a lower level than the current directory or the directory explicitly specified in the source file specification.
Wildcards and regular expressions should appear only in the file name portion of the file specification and not as part of the directory itself.