Open a Terminal Window at the Current Finder Selection

Have you ever used the Finder to navigate through several layers of folders to find a file you need to modify only to discover you need root privileges to complete the task? When that happens you have two choices: 1) You can open a terminal window and "cd" to the path of the folder in question or, 2) You can drag the folder from the Finder to the Terminal icon in the Dock while holding down <command-option> then use "sudo" to elevate your privileges. There's a free Rosetta app that opens a terminal window in the Finder's current folder, but alas, it (like all Rosetta apps) no workie in Lion. Here's a tip I found at Macworld.com to create a permanent tool in OS X Lion to do just that.
First launch the AppleScript Editor from your /Applications/Utilities folder and paste the following text into the edit window:
on run
tell application "Finder"
try
activate
set frontWin to folder of front window as string
set frontWinPath to (get POSIX path of frontWin)
tell application "Terminal"
activate
do script with command "cd \"" & frontWinPath & "\""
end tell
on error error_message
beep
display dialog error_message buttons¬
{"OK"} default button 1
end try
end tell
end run
Next, save the file as an application. (I named mine "TerminalRightHere", saved it in the /Applications/Utilities folder, but you can call it anything and put it anywhere you like) Then, in Finder, simply drag your newly-created app up to the Finder's toolbar. It will stick and will be in every new Finder window until you (<command>)drag it out. Now, clicking on the new app in the Finder toolbar will open a terminal window at the current Finder location. Cool. Many thanks, Macworld!



