Change directory to current Finder's path
Put this little bash function in your .bash_profile
and you can change to the directory of the current Finder's path. Just type cdf
:
cdf() {
target=`osascript -e 'tell application "Finder" to if (count of Finder windows) > 0 then get POSIX path of (target of front Finder window as text)'`
if [ "$target" != "" ]; then
cd "$target"; pwd
else
echo 'No Finder windows are opened' >&2
fi
}
Written by Theo Pack
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#