Skip to content

Instantly share code, notes, and snippets.



Created Dec 2, 2011
What would you like to do?
Script to cd to the last opened finder directory
# function to change directory to the one set in the last opened finder.
cdf () {
currFolderPath=$( /usr/bin/osascript <<" EOT"
tell application "Finder"
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
echo "cd to \"$currFolderPath\""
cd "$currFolderPath"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment