There are undocumented wildcards that you can use to achieve this as well.
IF EXIST "D:\*Backup*.<" (
ECHO "file exist"
) ELSE (
ECHO "file not exist"
)
This wildcard option and other were discussed in length at the following two links.
- [WayBack] http://www.dostips.com/forum/viewtopic.php?t=6207
- [WayBack] http://www.dostips.com/forum/viewtopic.php?f=3&t=5057
From those links:
The following wildcard characters can be used in the pattern string.
Wildcard character Meaning
* (asterisk)
Matches zero or more characters
? (question mark)
Matches a single character
"
Matches either a period or zero characters beyond the name string
>
Matches any single character or, upon encountering a period or end of name string, advances the expression to the end of the set of contiguous >
<
Matches zero or more characters until encountering and matching the final . in the name
Leave a Reply