Wildcards

From CastleCopsWiki

Jump to: navigation, search

One further thing before we get onto the commands themselves - wildcards. The most useful is the asterisk (*). * stands for any character or set of characters in a filename or directory name. Thus:

1208*.log 

means any .log file beginning with '1208'

*nav*.exe 

means any executable file containing 'nav' within the filename

*.txt 

means any text file

*.* 

means any file.

Proceed with caution when using wildcards, especially this last command. It will wipe all files in the directory.


A more controllable wildcard is the query (?).  ? stands for any single character in a filename or directory name. Thus:

?208.log 

means any .log file ending with '208' and having a filename exactly 4 characters long

install.?at 

means any file named 'install' which has a 3-character extension ending with 'at' (for instance, .bat or .dat)


The two wildcards can be combined to provide a further refinement to a command:

normal*.do? 

means any file which has a filename starting with 'normal' and a 3-character extension starting with 'do'. Thus .doc and .dot files would match the criteria, but .doch files would not.


(It should be noted that wildcards can also be used in the manner outlined above when using the Windows Search facility, to better constrain the search results to the information required.)

Personal tools