Tuesday, February 28, 2012

Finding Files or Programs – Part II

In my previous tip, I showed how easy it is to search files or programs. Certainly, when you already know the full and complete name of the file, your job is much easier.

However, what if you can only remember part of the filename? Or let’s say that you wanted to find any documents that you had worked on with the word “Budget” in them?

Before I start into the tip, there’s a little fundamental tidbit about how Windows names files. As you know, when you save a file, typically you give it a filename. Let’s say you’re creating a Microsoft Word document called “Grocery List”. What any Windows application will do is to also append a suffix to the filename to indicate what program was used to create or edit the document so that when you go to edit this document, Windows will know if it is to open up the file in Microsoft Word or Microsoft Excel. This suffix is referred to as an extension. The extension is typically a 3 or 4 character code created automatically by the application program.

To illustrate, take a look at my folder where I keep some my articles.


You’ll see that there is a column in my explorer called “Type”. This is based directly on the extension associated with the file. You’ll see a bunch of MS Word documents followed by one MS Excel document. In this folder, all of the Word documents have an extension of .docx and the Excel document has an extension of .xlsx

When you know the full and exact name of the file (such as “banana bread recipe.docx”) it’s much easier for you as you can just type the name of the file that you’re looking for. You’ll see that in my example here, the full name of the file starts with the name that I’ve given it (banana bread recipe) followed by the extension of the file (docx) and that there is a . so that the computer knows where the filename ends and the extension starts.

In those cases where you only know part of the filename, the operating system provides two different special symbols that are referred to as wildcards. Just like in a normal deck of playing cards, a wildcard can be used for anything but there are a couple of differences on the wildcards.

The first wildcard is the ? character and it will substitute one – and only one character. In other words, the filename pattern of j?n.docx would match either jen.docx or jon.docx. In English, the filename pattern could be interpreted as “any file where the first letter is a J, the second letter is anything else, the third letter is an N and the extension is .docx”.

The second wildcard is the * character and it is more powerful. It can replace any number of characters. Using the same example, the filename patter of j*n.docx would still match jen.docx and jon.docx but it would also match Jamison.docx.

Wildcards can be combined and repeated and can be at the beginning, in the middle or at the end of the filename (or even the extension if need be).

To close off this tip, here are some examples of wildcard patterns along with an English like description of how they would be interpreted.


Filename Pattern
Description
?arm.docx
Any filename that is exactly four characters wide and where the last three characters are arm and has a docx extension.
*budget.pdf
Any file with a PDF extension where there are 0, 1 or more characters of any combination suffixed with budget.
201? Taxes.xlsx
A file with an xlsx extension where the first 3 characters are 201, there is an  fourth character and the suffix of the filename is taxes.
*family*history*.docx
Any MS Word document (or that has a .docx extension) where there is 0, 1 or more characters, followed by the word family, an additional 0, 1 more characters, the word history and a suffix of 0, 1 or more characters.
F?ar?_sales*.*
Any filename that begins with an F, has one character, the characters ar, followed by one more character, the word sales and any suffix of 0, 1 or more characters.   In this example there is a wildcard in the extension so it would match any file types.
*.*
Every single file as this means any text in the filename and any text in the extension.


No comments:

Post a Comment