Wildcard question

May 20, 2008
10,987
86
Syracuse, NY, USA
Below, should doggy.txt have been deleted?
Code:
v:\> del doggy.txt.*
Deleting V:\doggy.txt
Deleting V:\doggy.txt.aa
Deleting V:\doggy.txt.ab
    3 files deleted
 
v:\> del doggy.txt.?*
Deleting V:\doggy.txt
Deleting V:\doggy.txt.aa
Deleting V:\doggy.txt.ab
    3 files deleted
 
v:\> del doggy.txt.??
Deleting V:\doggy.txt
Deleting V:\doggy.txt.aa
Deleting V:\doggy.txt.ab
    3 files deleted
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,345
80
Albuquerque, NM
prospero.unm.edu
Below, should doggy.txt have been deleted?
Code:
v:\> del doggy.txt.*
Deleting V:\doggy.txt
Deleting V:\doggy.txt.aa
Deleting V:\doggy.txt.ab
    3 files deleted
 
v:\> del doggy.txt.?*
Deleting V:\doggy.txt
Deleting V:\doggy.txt.aa
Deleting V:\doggy.txt.ab
    3 files deleted
 
v:\> del doggy.txt.??
Deleting V:\doggy.txt
Deleting V:\doggy.txt.aa
Deleting V:\doggy.txt.ab
    3 files deleted


Have you tried this?

Code:
DEL DOGGY.TXT.[?]*
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,345
80
Albuquerque, NM
prospero.unm.edu
Or, probably more appropriate to what you're trying to do:

Code:
del doggy.txt[.]*

The [.] only matches an actual period character. (I presume TCC's somewhat surprising behavior is meant to accommodate the die-hard DOSheads who continue to use *.* to mean "all files"....)
 

rconn

Administrator
Staff member
May 14, 2008
12,134
138
Below, should doggy.txt have been deleted?

Yes -- try it in CMD, and see the same results.

If you don't want the Windows "match one or more characters unless at the end of the name or extension, in which case also match 0 characters" behavior, use regular expressions instead. They tend to be much more predictable!