Home > Articles

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Finder File Operations

Because you're reading an Unleashed title, you probably already know the basics of most graphical operating systems: click and drag files to move them, double-click applications to launch them. Mac OS X doesn't break any new ground in the handling of files. Everyone who has used Windows, KDE/GNOME, or an earlier version of Mac OS will be able to carry their existing knowledge over to the new operating system. To be thorough, this portion of the chapter will serve as a quick reference to standard file and application operations.

Moving Files and Folders

Moving a file changes its location, but does not alter the contents of the file or its creation and modification dates. To move a file on Mac OS X, drag its icon to the folder or location where you want it to reside. If you are dragging within a Finder window, the window will automatically scroll as your cursor reaches the border, allowing you to move around within the view without having to drop the icon and manually scroll the window.

Using the Spring-loaded folder feature of Mac OS X 10.2, you can drag items onto closed folders, and after a few seconds, those folders will "spring" open, allowing you to continue the drag operation. To force the "spring" action to occur immediately, press the spacebar while hovering over the folder you want to open.

NOTE

Mac OS X 10.2 also includes "Spring-loaded windows." Spring-loaded windows will "spring" onto the screen when an icon is dragged over them. To demonstrate this effect, drag a Finder window to the bottom of your screen until only the title bar is showing. Next, drag an icon over the title bar—the window will spring up from the bottom of the screen, and then disappear when you release the item or move your mouse off the window. You can force a window to "spring" immediately by pressing the spacebar.

If you are attempting to move a file from one device (such as a disk) to another, the file will be copied instead of moved. The original file will stay in its current location, and a new version will be created on the other storage media. You must delete the original copy of the file if you do not want to keep multiple versions of the file.

TIP

Finder (and some application) windows include a proxy icon in the title bar. If you click and hold this miniature icon for a few seconds, it becomes draggable. The icon represents the currently open folder or document and can be used just like dragging the item's icon within the Finder window.

Copying Files and Folders

Copying a file creates an exact duplicate of an original file. The new file sports a new creation and modification date, although the contents are identical to the original. There are a number of ways to create a copy on Mac OS X.

Drag a file to a different disk—Dragging a file to a disk other than the one it is currently stored on will result in a copy of the file being created at the destination. The copy will have the same name as the original.
Drag a file while holding down Option—If you drag a file to a folder on the same disk it is currently located on while holding down the Option key, a duplicate of that file will be created in the new location. If the Option key is not held down, this will normally just move the file. The copy will have the same name as the original.
Choose Duplicate from Contextual/Finder menu—If you want to create an exact duplicate of a file within the same folder, highlight the file to copy, and then choose Duplicate from the Finder's File menu (Command+D). Or, alternatively, Control-click the icon and choose Duplicate from the pop-up Contextual menu. A new file will be created with the word copy appended to the name.
Use the Finder Contextual Menus—Control-click on a Finder icon (or selection of multiple icons); then choose Copy. Next, locate where you'd like to copy the files to and then choose Paste from the Edit menu. Windows users will recognize this immediately.

TIP

Mac OS X recognizes many two-button mice and automatically maps the second button to the Control-click command. Additionally, many mice that include scroll-wheel functionality will automatically work in Cocoa-based applications.

In addition, the scroll wheel on many mice can be used to control the scrolling of windows. If you have this feature, you can also scroll horizontally by holding down the Shift key while using your scroll wheel.

As the file copies, the Finder will display a window, like that in Figure 3.17, where you can see the progress of the copy operation. If multiple copies are taking place at the same time, the status of each operation will be shown stacked on one another in the copy status window. There are two copies taking place in Figure 3.17. If you'd like to collapse the copy to show only summary information about the copy (time remaining), click the disclosure triangle at the left of the copy status.

Figure 3.17Figure 3.17 A single window contains all the status information for multiple copy operations.

If you attempt to copy over existing files, the Finder will prompt you whether you want to replace them, and provide a check box Apply to All to apply your decision to any other conflicting files it finds during the operation. Remember that under Mac OS X, you cannot alter certain system files and directories or another user's files. If you attempt to replace existing files to which you do not have access, the copy operation will fail.

Deleting Files and Folders

Deleting files and folders permanently removes them from your system. Although the Mac OS X Finder has a new Undo menu, it cannot undo the effects of erasing a file from your system. Like copying a file, there are a number of ways to delete:

Drag to Dock trash—Dragging an icon from a Finder window into the Dock's trash can is one of the most obvious and easy ways to get rid of a file.
Move to Trash Contextual/Finder menu—You can move a selected item to the trash by Control-clicking the icon and choosing Move to Trash from the Contextual menu, or choosing the option of the same name from the Finder's File menu.
Finder Toolbar—A Delete shortcut can be added to the Finder's toolbar. Any items selected can be quickly moved to the trash by clicking the Delete shortcut. Delete is not one of the default toolbar icons.

Moving an item to the trash does not delete it permanently from your drive. Instead, it places the item inside an invisible folder called .Trash—you cannot see or access this folder directly from the Mac OS X GUI. If you're interested in getting to the contents of the folder, check out the discussion of command-line navigation, starting in Chapter 12. The trash can icon in the Dock fills with crumpled paper when it contains items waiting to be deleted.

Although Mac OS X doesn't give you a true representation of the .Trash folder, it does let you view the contents of the trash by clicking the trash can icon. The Trash window works identically to other Finder windows. If you want to rescue a file you've accidentally sent to the trash, you can drag the file's icon out of the trash.

To completely remove a file from your system, choose Empty Trash from the Finder's application menu, or press Shift+Command+Delete. Alternatively, you can Control-click or click and hold on the trash can, and choose Empty Trash from the resulting pop-up menu. Holding down Option when Emptying the Trash (including via the keyboard shortcut) will bypass the Finder's warning messages.

Emptying the trash might take a few moments if you are deleting a large number of files. During this time, the Finder will bring up a dialog box very similar to the Copy dialog box. You can click Stop to cancel the trash operation, sparing the files that haven't yet been erased.

Creating Aliases

An alias is a representation of a file that, for all intents and purposes, appears to be the file. Windows users will recognize it as being similar to a shortcut.

Suppose that you have a document called My Diary buried deep in your drive, but you want to leave a copy of the icon on your desktop. Rather than duplicating the file and maintaining two copies, you can create an alias of the original file, and then place the alias wherever you'd like. Accessing the alias is the same as accessing the real file. The Finder uses aliases for things like Recent Folders and Favorites. Rather than having to move the real directories, it can just create aliases of them. You can tell an alias from the original by the arrow in the lower-left corner of the icon. Figure 3.18 shows the Favorites folder, filled with aliases to other folders.

Figure 3.18Figure 3.18 Aliases represent real files on your system.

There are two ways to create aliases:

Drag a file while holding down Option+Command—If you drag a file to a folder while holding down the Option+Command keys, an alias of that file will be created in the new location.
Choose Make Alias from Contextual/Finder menu—If you want to create an alias of a file within the same folder, highlight the file to alias, and then choose Make Alias from the Finder's File menu (Command+L), or Control-click the icon and choose Make Alias from the pop-up Contextual menu. A new file will be created with the word alias appended to the name.

Although aliases can be used to represent the original file, throwing them away does not delete the original file. Alternatively, deleting the original file doesn't delete the alias. If the original file is erased, the alias simply becomes broken. Double-clicking a broken alias will display a dialog similar to the one in Figure 3.19.

Figure 3.19Figure 3.19 Broken aliases can be deleted or fixed.

If you'd just like to get rid of a broken alias, click the Delete Alias button. If you want to point the alias to a different file, choose Fix Alias, locate the file you want to use, and the alias will be reattached. To leave things the way they are, click OK.

NOTE

Aliases aren't quite the same as symbolic links in Linux. The Mac file system assigns a unique identifier to each file. Aliases reference that identifier and can be used to locate a file wherever it is on your drive. If the original is moved, the ID does not change, and the alias continues to work. Aliases do not translate to the BSD subsystem in any form.

Show Original

To locate the file to which an alias points, select the alias and choose Show Original (Command+R) from the Finder's File menu for the icon's contextual menu. The original file will be highlighted in the Finder.

Launching Applications/Documents

We're saving the easiest for last. Launching an application is a matter of double-clicking its icon, or dragging a document on top of the application's icon. In the latter case, the application will start and load or process the document that was dropped on it.

You can also launch an application by selecting it, and then choosing Open from the Finder's File menu or from the contextual menu. If you're opening a document and would like it to load into an application other than its default application, use the File menu's Open With option. To set a file to always open with an alternative application, hold down Option and the Open With selection will change to Always Open With.

NOTE

If you use a Contextual menu to open an application, you might notice a Show Package Contents selection in the menu as well. Only available on certain applications, this will effectively open the application as if it were a folder, showing the various resources (images, sounds, and so on) that the application uses. You'll find out more about this in Chapter 11, "Additional System Components."

While an application is launching, its icon will bounce in the Dock.

Unrecognized Files

If you attempt to double-click a document that the system does not recognize, Mac OS X will warn you that there is no application available to open the document you've tried to access, as demonstrated in Figure 3.20. If you're sure that a program on your system is capable of viewing the file, select the Choose Application... button. You will be prompted to choose the application that will open the file. If the system does not allow you to pick the appropriate application, change the selection in the Show pop-up menu to read All Applications rather than Recommended Applications. By default, the system tries to guess the best app for the job—sometimes it fails miserably.

Figure 3.20Figure 3.20 If a file can't be opened, you can choose an application to open it with.

You can also fix unrecognized files by setting the application to open them through the Get Info Finder command, discussed later in this chapter.

Renaming Files

To rename a file in the Finder, click on the file's icon label. The filename will become editable in a few seconds. If you're the impatient sort, just press Return after selecting an icon; you'll immediately find yourself in edit mode.

Alternatively, you can use the Get Info option in the Finder File menu to edit the name in a larger field.

The Edit Menu

The Edit menu is used universally in almost every application that you'll run under Mac OS X. It has been duplicated on Linux, Windows, and just about every other GUI-based OS on the planet. The Edit menu allows a user to quickly select, copy, and cut information from one place in the system and paste it somewhere else. While the information is waiting to be added to another document, it is temporarily housed in what is called the Clipboard.

Mac OS X has six basic features available from the Finder's Edit menu:

Undo/Redo—The Undo command was introduced with Mac OS X. It allows you to reverse just about any action you've taken in the Finder, aside from emptying the trash. If you've moved a file or created a copy you don't need, just undo it. If you find that you've undone something you didn't mean to, the Undo menu will change to Redo—effectively enabling you to undo your undo. Although useful, this command has little in common with the other Edit menu options (Command+Z).
Cut—Cuts a piece of information (text, graphic, sound, and so on) from a document. The information is removed from the current file and placed in the Clipboard for reuse (Command+X).
Copy—Like Cut, but leaves the information in the original document and creates a copy of the data within the system Clipboard. If Copy is chosen when a Finder icon is selected, that file is prepared for duplication. The process is completed by choosing Paste (Command+C).
Paste—Pastes the contents of the clipboard back into the frontmost document or field. If the receiving element cannot handle the type of data you are attempting to paste (pasting a sound into a text field, for example), the Paste operation will fail. If you've previously used Copy while a Finder file icon was selected, the file will be copied to the location represented by the currently active Finder window (Command+V).
Select All—Highlights all selectable items within a window or document (Command+A).
Show Clipboard—Choosing Show Clipboard will display a small Finder window with the data that has been cut or copied from an application. Restarting your computer or logging out will lose the contents of the Clipboard.

NOTE

The Edit menu works to cut and copy information between native Mac OS X applications and applications running in the Classic environment. Unfortunately, the integration between these two effectively separate operating systems is such that you might need to wait a second or two between a cut/copy and a paste for the information to find its way to the appropriate destination.

Performing File and Content Searches

In addition to organizing your files, the Finder enables you to find applications by filename or documents by filename or their contents. But the best part is that the search results are interactive. You can launch located programs and applications by double-clicking their icons in the results pane. Also, dragging a file or folder to the Desktop or a Finder window moves that object to a new location. This is a quick way to clean up when you've accidentally saved a file to the wrong folder.

The Finder window provides a quick means of performing a name-search. To do this, open a Finder window by double-clicking on the folder or drive containing the file you want to find and switch to toolbar mode if you aren't in it already. Type your search term in the Search field in the toolbar and press Return. After a few seconds the search results are displayed within your window. To return to the file listing you were viewing before the search, use the toolbar's Back arrow.

If you'd like to do a search of file contents or search more attributes than a simple filename, choose Find (Command+F) from the File menu. Using the Search In pop-up menu, choose where the search will take place:

  • Everywhere—Examines all drives and user accounts.

  • Local Disks—Examines only the current drive, but all user accounts.

  • Home—Examines only the Home directory of the person currently logged in.

  • Specific Places—Displays a list of available drives for you to choose. You can also click the Add/Remove button to insert or remove specific folders.

Pick whether to search for filenames, contents, or both. Enter your search text into the appropriate field(s). If you'd like to add additional search terms in these categories, click the "+" buttons beside the fields to add additional conditions, or the "-" button to remove them. Use the comparison pop-up menu to choose what determines a file "match"—such as "contains", "starts with", or "ends with" the given text.

If you'd like to refine your search further, click the Add Criteria pop-up for setting options, including Date Modified, Date Created, Kind, and Extension. The additional search parameters will appear below the filename and content search boxes, again followed by "-" and "+" buttons to remove them or add additional variations.

Finally, click the Search button to start the search.

In a few moments, the search results are displayed, as seen in Figure 3.21.

Figure 3.21Figure 3.21 Search directly within the Finder interface.

NOTE

If the search is taking too long, click the X button in the search window (or the Finder window's Search field) to stop searching. When displaying search results, the X button changes to "chasing arrows" allowing you to refresh the list.

For each result, Find lists the filename, the date it was modified, its size, and the kind of file. After an item has been highlighted, its path is shown in the details pane at the bottom of the window. Double-clicking will open the file, folder, or application.

NOTE

Searching for file contents requires that the directory containing the file be indexed, or cataloged. You can index a folder, or check for the last date of last indexing, using the Get Info panel.

  • + Share This
  • 🔖 Save To Your Account