Tuesday, September 24, 2013

Finder and Alias

Finder is a UI interface to access to Mac file system. This UI is a pure UI interface with no direct way to enter a path, such as address text box in a browser or Windows File Explorer. In Finder's menu, there is one menu item Go to Folder... under Go, or press Shift+Command+G. From there you can type in a path.





The first issue I open encounter is how to get the full path of a folder. From Finder's status bar (if enabled in Preference), or Header area on top(in Mountain Lions +), the full path are layout like a hierarchy chain, which is not full path for copying.

The second issue is that in a browser, if you try to upload or attach a file, a Finder like dialog does not have "Go to Folder..." menu. From this pure UI, it is really hard to browse to a deep path on your Mac.

Here I found a solution to resolve the issue: using Mac alias. Mac is Unix system, alias. Alias is a small file reference to another object in Unix file system, file or folder, for example. I put an alias on left panel of Finder. This is a quick shortcut to a folder.

There are many ways to create alias. Here are two I found very convenient.

Create Alias in a Folder


I use Automator to create an alias in a specified folder, for example, MyAlias. I create this folder first at my home account, and then place it on the left panel of my Finder.


The service created by Automator is a very simple one like this:


Select Service.


First block: Service received selected "Files or Folders" in "Finder.app",
Second block is New Alias and in "MyAlias"

Save the service as "AddToMyAlias". Now this service is ready for use.

For example, try to review a photo in iPhoto app to Finder. Right click on the folder, select "AddToMyaAias" from services.


A new alia is created in MyAlias folder!



Using Terminal ln Command


An alias can be easily created in Terminal by Unix command. The command is ln with source path and an alias name. The source path may be a long string as a full path, for example, the above one. I prefer to find out a convenient way to get full path, instead of typing it from Finder.

Here I use Automator again to create a tool, which is used to get full path in Finder. The auto-workflow is a very simple one, just passing Finder's file or folder to clipboard:


I give the service a name as CopyPathToClipboard.

With a full path available, an alias can be easily created by ln command in a Terminal.

~ myAccount$ ln -s /Users/myAccount/Library/Services ~/MyAlias/MyServices

The above command creates a symbolic alias "MyServies" to my account's Library/Services folder. As a result, I can easily see what are in my services from Finder:


By the way, alias is a kind of shortcut to a file or folder. Deleting it will not cause original one lost.

1 comment:

Anonymous said...

Hi, I found your blog while I was looking for a way to do under Lion what I had set up in Tiger as a contextual menu to make aliases in specified folders.
Your hint was very useful.
I am wandering now how one could make the folder, where the alias is created, open.
Furthermore, is it possible to build a service to make an alias in a folder to be chosen each time?
Thanks.