Finding Files and Folders on Your Mac

graphics/new10point2_icon.jpg

Previous versions of Mac OS X used Sherlock to search for files and folders and to search the Internet. Fortunately, Apple has restored and improved the Finder's Find command that you use to locate local resources (Sherlock, improved for version 10.2, is still used to search the Web).

There are two ways to search for files and folders on your Mac. The first is to search by attribute, such as name, creation date, or size. The second is to search by content. Previously, these two types were separate?you had to choose one or the other. Under version 10.2, you can now mix and match search types as you need to.

NOTE

In this context, on your Mac means that what you are searching for is on a volume that is mounted on your Mac. This includes volumes that are located on a network to which you are connected.


Finding folders and files by attribute is useful when you know that an item exists, but you just can't remember where it is, what it is called, and so on.

Finding files by content is a great help when you know that there is a file on a machine that contains a word, phrase, sentence, or topic, but you can't quite remember what the name of the file is or even when it was created. You can also use the Find by Content feature to locate all the files you can access that relate to a specific topic or concept.

Finding Folders and Files by Attribute

The most common type of search you are likely to do is to search by attribute, such as name or creation date. You can search by one or more attributes at the same time.

NOTE

In the context of searching by attribute, "file name" is synonymous with "folder name."


To search by attribute, use the following steps:

  1. From the Finder, choose File, Find (or press graphics/symbol.gif+F). You will see the Find window (see Figure 4.9).

    Figure 4.9. The Mac OS X Find function is both powerful and flexible.

    graphics/04fig09.jpg

  2. Choose the location in which you want to search on the Search in pop-up menu. You have the following options:

    • The Everywhere option will search in all volumes that are mounted on your Mac, including its internal drives and removable discs and volumes on your network.

    • The Local disks option searches only those volumes that are physically installed in your Mac (including removable discs).

    • The Home option searches only in your Home directory.

    • The Specific places option enables you to select the volumes you want to search; when you select this, an additional pane will appear. Check the check boxes for the volumes you want to search. Click the Add button and select individual folders to search specific folders (the volume on which those folders are located does not have to be selected).

  3. The file name criterion is included in the search by default. If you don't want to search by file name, click the Remove attribute/criterion button next the file name field and skip to Step 10.

    NOTE

    You can't remove a criterion if it is the only one contained in the search.

  4. Choose the operand for the file name on the pop-up menu. By default, this is "contains," but you can change it to "starts with," "ends with," or "is." The meaning of these operands is self-explanatory.

  5. Enter the text or numbers for which you want to search in the field. The more information you enter, the more specific your search will be, no matter what operand you select.

  6. If you want to add additional criteria for file name, click the Add criterion button. An additional pop-up menu and field will appear.

    NOTE

    A limitation of the Find tool is that all criteria for an attribute are connected with an "and." This means that all criteria for that attribute must be met in order for an item to be found. Unfortunately, there isn't an easy way to do "or" searches, such as this file name or that one. You'll learn a workaround later in this section.

  7. Use the pop-up menu to choose the operand for the second file name.

  8. Enter the second file name for which you want to search in the field.

  9. Repeat Steps 6 through 8 for each file name for which you want to search.

  10. Choose the next attribute by which you want to search on the Add criteria pop-up menu. Your options are date modified, date created, kind, size, extension, and visibility. You will see only those attributes that aren't already included in the search on the pop-up menu. The attribute you choose will appear in the window along with any tools you use to define its search criteria.

  11. If applicable, use the pop-up menu to choose the operand for the attribute you selected. For example, if you chose date modified, the available operands are is today, is within, is before, is after, is exactly, or no value.

  12. Use the attribute's field, if one appears, to enter the value for which you want to search. For example, if you selected the date modified attribute and the is after operand, enter that date for which you want to search.

  13. If you want to add additional criteria for the attribute, click the Add criterion button. An additional pop-up menu and appropriate fields will appear.

  14. Use the pop-up menu to choose the operand for the criterion you added.

  15. Enter the value for which you want to search in the field if applicable.

  16. Repeat Steps 13 through 15 for each criteria you want to add for the attribute.

  17. Repeat Steps 10 through 16 for each attribute you want to include in your search.

  18. Click the Remove attribute/criterion button for any attributes you are going to search on. For example, remove the content attribute if you are not including it in your search.

  19. Review the Find window to ensure that the search is configured properly (see Figure 4.10).

    Figure 4.10. This search will find all files for this book (file name contains 2904) that were modified after 8/1/02 and that are less than 1MB.

    graphics/04fig10.jpg

  20. Click Search (or press Return). A separate Search Results window will appear. At the top of the window, you will see the number of places being searched and will see the progress of the search. You can cancel the search by clicking the "x" button that appears in the window's status bar. When the search is complete, the "x" becomes the Refresh Search button, and the items that met your search criterion will appear (see Figure 4.11). The results window contains two panes. The upper pane lists all the files that meet your criteria. The lower pane shows the location of items selected in the upper pane. To resize the panes, drag the Resize handle in the middle of the separating line between the panes.

    Figure 4.11. A number of files that met my search parameters were found.

    graphics/04fig11.jpg

The Search results window works just like a Finder window in List view. For example, you can sort it, open items from within in, and so on.

You can view the location of any found item by selecting it. The path to that item will appear in the lower pane.

Following are some additional tidbits about searching with the Finder:

  • The Find window and the resulting results window are independent. You can move the windows around so that you can see both of them at the same time.

  • Each time you click the Search button, a new results window appears. You can run the same search as many times as you want. For example, you can refine a search by running it, viewing the search results, moving back to the Find window and modifying the search, and then rerunning it.

    This also enables you to perform pseudo-"or" searches. Perform the first search. Then move back to the Find window, revise the search (such as by changing the file name), and run it again. The two results windows will show you the files that meet both sets of criteria.

  • You can rerun a search by clicking the Refresh Search button (the double-arrow icon) in the status bar of the results window.

  • Unfortunately, you can't save your searches unlike when you used Sherlock to search for files and folders. If you want to run the same search again, leave the results or Find window open. If you close both of these windows, the search is lost and you will have to re-create it to run it again.

Finding Files by Content

Performing content searches is very similar to performing attribute searches. The only significant difference is that any sources you are going to search by content must be indexed first. When a volume is indexed, all the files it contains are searched and a list of keywords is built.

CAUTION

To be able to index a server or a folder that is shared, you must be the server's administrator or the folder's owner. If these conditions aren't true, the Index Status column will show "Not indexable." This indicates that you can't index the volume, so you won't be able to search it for files by content.


To index sources you want to search, carry out the following steps:

  1. Select the source you want to index and press graphics/symbol.gif+I to open the Info window.

  2. Expand the Content index section (see Figure 4.12). The current index status will be shown.

    Figure 4.12. You can index a source using the Content index section of the Info window.

    graphics/04fig12.jpg

  3. Click Index Now.

You will see the progress of the indexing process in the window. If there are many items to be indexed, this process can take quite a while. You can abort the process by clicking the Stop Indexing button. When the process is complete, the status information will be updated accordingly. The source will then be ready for content searches.

Indexes are created when you execute the Index Now command. As files change, the index becomes out of date. If you search by content regularly, you should re-index your sources periodically to keep the indexes current.

NOTE

Unfortunately, you can't schedule indexes to be run periodically as you could when Sherlock was used to search for files and folders. To automate the indexing process, you will need to use AppleScript or another automation tool.


After you have created an index, performing content searches is not difficult.

  1. Create a search as explained in the preceding section.

  2. Add the Content attribute to the search. (You can search for only a single content criterion at a time.)

  3. Enter the content for which you want to search in the field.

  4. Configure other attributes for the search.

  5. Execute the search. Items that include the content you specified and meet the other search criteria will be listed in the results window.



    Part I: Mac OS X: Exploring the Core
    Part III: Mac OS X: Living the Digital Lifestyle