home Tech Understanding the wildcards

Understanding the wildcards

Wildcards can be pretty helpful when doing some basic tasks either from the Windows GUI or the beloved command prompt.

Let’s take a look at the frequently used wildcard * for doing some simple but effective stuff.

For understanding purposes,I have created a folder called textfiles in C: with the following files :

apples.txt,oranges.txt,bananas.txt,applejuice.txt,orangejuice.txt.bananajuice.txt

wcards1

Let’s say we want to see only files that start with the word “apple” from this directory.To do this,we just use the * card like this :

dir apple*.txt

wcards2

This will display the files which start with the word apple.

Let’s say we need to display files whose names contain the following words – “juice” at the end.

This is done by the simple command : dir *juice.txt

wcards3

The placement of * at the beginning,the middle or the end means that the specified part where it is inputed can be anything as in all.

Example : this command dir *an*.txt will list those files that have “an” word in it regardless of what the starting and ending characters are.

wcards4

What if you need to list all files regardless of what they are named?

It can be done simply by typing dir or dir *.*

wcards5

Feel free to do some not so usual stuff like sorting filenames and redirecting their output to a file on a regular basis or so on.

Definitely a weekend fun project 😉

4 thoughts on “Understanding the wildcards

Leave a Reply

Your email address will not be published. Required fields are marked *