Execute "Get Info" on a file from command line in Mac OS X

This also supports multiple files and make Finder active. The utxt method is only needed in 10.4 and earlier.

si() {
    osascript - "$@" <<-END > /dev/null 2>&1
    on run args
    tell app "Finder"
    activate
    repeat with f in args
    open information window of (posix file (contents of f) as alias)
    end
    end
    end
    END
}

STDOUT is redirected because osascript prints the result of the last expression and STDERR because 10.8 shows a warning like CFURLGetFSRef was passed this URL which has no scheme when a relative path is converted to an alias.


I know that I am not truly answering your question, but I get alot of the info I need from using ls -l and the file command.


Try This out, I found this at http://forums.macosxhints.com/showthread.php?t=10149

#!/bin/sh

# This script opens the Finder's "Get Info" window
# for the file or folder specified as a command-line argument.

scriptname=`basename $0`
if [ $# -lt 1 ]; then
    echo "Usage: $scriptname file_or_folder"
    exit
fi

path=$1

if [ ! -e $path ]; then
    echo "$scriptname: $path: No such file or directory"
    exit
fi

case $path in
/*)     fullpath=$path ;;
~*)     fullpath=$path ;;
*)      fullpath=`pwd`/$path ;;
esac

if [ -d $fullpath ]; then
    file_or_folder="folder"
else
    file_or_folder="file"
fi

/usr/bin/osascript > /dev/null <<EOT
tell application "Finder"
    set macpath to POSIX file "$fullpath" as text
    open information window of $file_or_folder macpath
end tell
EOT