Tuesday, February 12, 2013

Use OS X services to reveal or open file paths

Apple's Spotlight offers a quick way to find user files and resources like applications or system preferences. However, it does not locate items in the system folder or in hidden folders, though at times you might need to access them. This limitation may be especially cumbersome to deal with if you are troubleshooting a problem in OS X or helping someone do so, meaning you may need to ask them to locate a specific hidden file and remove it or modify its contents.

For some system resources you can simply navigate through the Finder; however, in its default view the Finder does not show a number of hidden files and folders such as the user library. So, for example, if you tell someone to access his or her user library to locate the Fonts folder, since the user library is hidden he or she might instead erroneously access the global library at the root of the hard drive.

Even if you are familiar with standard Unix file path notation and direct someone to open the ~/Library folder, if that person doesn't know what the tilde character means then he or she might go to the wrong directory in the Finder.

To get around these potential areas of confusion both for yourself and when instructing others, you can make use of some services and features in OS X that make possible quick access to any file or folder based on a typed path you provide, which can help avoid confusion and make it straightforward for anyone to open a specified Unix-compliant path.

The first option is to use the system's contextual services: if you have a full Unix-compliant path typed out, then you can simply highlight it, right-click the selected text, and then choose either Open or Reveal from the Services contextual menu, and the system will then display the item in the Finder or try to open it with its default handling application.

For example, you can triple-click the following folder path examples or otherwise select each in its entirety, and try opening the items in the Finder (note that if you use the Open service the system may ask for confirmation before opening the path):

If you come across a file path as part of an instruction for tweaking your system or troubleshooting it, you can use these services to access it by selecting the file path and right-clicking in this way. Additionally, if you are attempting to help others access parts of their systems and you know the exact file or folder path they should use, then you can likewise send it to them and have them perform this procedure to quickly open it.
Open and Reveal services in OS X

These contextual services are built into OS X and should be enabled by default, but if they aren't then they can be enabled in the Services section of the Keyboard system preferences, under the Keyboard Shortcuts tab.

While useful for opening a full file path from a text document or Web page, these options are also convenient in other areas. If you are a power user and access the Terminal regularly, then you probably have a number of file paths listed in your command history that you previously acted upon. If you need to open one of these paths in the Finder, you can use these services to quickly select and open it.

A last and related way to navigate through a full file path is to use the OS X Go to Folder feature that is available in the Finder's Go menu (and can also be invoked by pressing Shift-Command-G). With this option, you can copy a full file path or even a partial one with respect to the directory of the current Finder window, and then paste it in the Go to Folder field instead of using the Open or Reveal services, which should open it for you in the Finder. For example, select and copy any of the file paths listed above, and then paste it in the Go to Folder field to have the system open it in the Finder.

No comments:

Post a Comment