From f6e88269c6a5590a28a1e75e9b07e9422c6629c6 Mon Sep 17 00:00:00 2001 From: Joe Block Date: Sat, 7 Nov 2015 07:18:44 -0800 Subject: [PATCH] Add function to show the path to the frontmost finder window --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index e6320da..98c54da 100644 --- a/README.md +++ b/README.md @@ -388,6 +388,19 @@ textutil -convert html file.ext sudo chmod -RN /path/to/folder ``` +#### Get Path of Frontmost Finder Window +```bash +function finder_path { + osascript -e 'tell application "Finder"'\ + -e "if (${1-1} <= (count Finder windows)) then"\ + -e "get POSIX path of (target of window ${1-1} as alias)"\ + -e 'else' \ + -e 'get POSIX path of (desktop as alias)'\ + -e 'end if' \ + -e 'end tell'; +} +``` + #### Hide Folder in Finder ```bash chflags hidden /path/to/folder/