...
Character | Behavior |
---|---|
** | Matches and any files in any directories |
* | Matches files in in a directory |
? | Matches a single character in a file/directory name |
Examples
Example file system:
Code Block |
---|
Output\
Binaries\
App.exe
Installer.exe
Helpers\
setup.bat
cleanup.exe
Images\
logo.png
Website\
connect.jpeg
App\
error.png
license.jpeg
Source\
App.cs
MoreCode.cs
ServerApp.exe |
Wildcard Example: **
To find all files ending in .exe
you could use the pattern: Output\**.exe
It would return the following files:
Code Block |
---|
Output\ServerApp.exe
Output\Binaries\App.exe
Output\Binaries\Installer.exe
Output\Binaries\Helpers\cleanup.exe |
Wildcard Example: *
To find all .exe
files in the Binaries
directory and not in sub-directories you would use the pattern: Output\Binaries\*.exe
It would return the following files:
Code Block |
---|
Output\Binaries\App.exe
Output\Binaries\Installer.exe |
Wildcard Example: ?
To find all files in the Images
directory that have a have file extension of 3 characters you would use the pattern: Output\Images\**.???
It would return the following files:
Code Block |
---|
Output\Images\logo.png
Output\Images\App\error.png |
Mixed Wildcard Example
To find all .exe
files in any sub-directory of the Output
directory you would use the pattern: Output\*\**.exe
It would return the following files:
Code Block |
---|
Output\Binaries\App.exe
Output\Binaries\Installer.exe
Output\Binaries\Helpers\cleanup.exe |
Info |
---|
For more information on Ant patterns, see the official documentation at http://ant.apache.org/manual/dirtasks.html#patterns |
...