Go Back   The macosxhints Forums > OS X Help Requests > UNIX - Newcomers



Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Old 03-12-2003, 10:40 AM   #1
octavius
Triple-A Player
 
Join Date: Jul 2002
Location: Osaka, Japan
Posts: 59
get info on a folder/app/etc.

how do i do it? like when i right-click on an icon and select Get Info. just wondering how to do with terminal.
__________________
...and the soul still burns...
octavius is offline   Reply With Quote
Old 03-12-2003, 10:47 AM   #2
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,459
not sure what you mean

I'm not sure what you are wanting to do. Are you asking how you can use a command in Terminal to bring up the GetInfo box on some file? Or are you asking what command to use in Terminal to get textual info (inside Terminal) on a file or folder?

If the latter, you need to look at the command 'ls'. For example:
ls -l
or
ls -l myfile
hayne is offline   Reply With Quote
Old 03-12-2003, 11:05 AM   #3
octavius
Triple-A Player
 
Join Date: Jul 2002
Location: Osaka, Japan
Posts: 59
simply open the GetInfo box. sorry that wasnt clear.
__________________
...and the soul still burns...
octavius is offline   Reply With Quote
Old 03-12-2003, 11:15 AM   #4
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,459
AppleScript maybe?

I don't know how to bring up the GetInfo window using a command in Terminal. This is a capability of Finder. But maybe there is a way to use AppleScript to ask Finder to do it. You can run AppleScripts from Terminal via the use of /usr/bin/osascript
hayne is offline   Reply With Quote
Old 03-12-2003, 06:58 PM   #5
brmic
Triple-A Player
 
Join Date: Nov 2002
Location: germany
Posts: 178
this works:
osascript -e 'tell application "Finder" to open information window of folder "Documents" of folder "yourUsername" of folder "Users" of startup disk'

sorry about the awful syntax, never understood path handling in AppleScript. still might be a starting point

good luck
markus
brmic is offline   Reply With Quote
Old 03-12-2003, 10:09 PM   #6
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 32,459
script to do it

Here's a Bourne shell script that seems to work.
Copy and paste it into a new file and make it executable with 'chmod'

Code:
#!/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
hayne is offline   Reply With Quote
Old 03-13-2003, 01:02 AM   #7
pmccann
Major Leaguer
 
Join Date: Jan 2002
Location: Adelaide, South Australia
Posts: 470
Nice script! There's a funky little companion script to this one at

http://forums.macosxhints.com/showth...cript+comments

Just allows you to set comments from the command line, but the implementation might be worth a gander if anyone's interested in this sort of thing. At this rate we'll have all Finder possibilities replaced by CLI equivalents by, say, 2038.

Cheers,
Paul
pmccann is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 10:06 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.