Created
December 2, 2011 09:30
-
-
Save emson/1422525 to your computer and use it in GitHub Desktop.
Script to cd to the last opened finder directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# function to change directory to the one set in the last opened finder. | |
cdf () { | |
currFolderPath=$( /usr/bin/osascript <<" EOT" | |
tell application "Finder" | |
try | |
set currFolder to (folder of the front window as alias) | |
on error | |
set currFolder to (path to desktop folder as alias) | |
end try | |
POSIX path of currFolder | |
end tell | |
EOT | |
) | |
echo "cd to \"$currFolderPath\"" | |
cd "$currFolderPath" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment