Wildcard question

May 20, 2008
11,185
94
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,397
83
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,397
83
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"....)
 
May 20, 2008
11,185
94
Syracuse, NY, USA
Have you tried this?

Code:
DEL DOGGY.TXT.[?]*
Yes, and that works. I had to write a little program to remind myself how the Win32 FindFirstFile/FindNextFile functions worked. Indeed, according to them, "doggy.txt" matches "doggy.txt.??".
 

rconn

Administrator
Staff member
May 14, 2008
12,247
144
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!