Command line folder closing

RTCDude

Registered
From a terminal, the 'open' command can be used to "open" a folder
in Finder. Is there a corresponding command to "close" a Finder folder?

Also, is there a command that will set the attributes of a folder, such
as view, window size, position, etc?

Thanks.
 
Okay, it can be done, but it's a little more involved than simply using the open command. Basically, you have to do it by running short Applescript commands. If you want to make a shell script to do it for you, it would look like this:

Code:
#!/bin/sh
osascript -e "tell application \"Finder\"" -e "close window \"$1\"" -e "end tell"

I saved it as /usr/local/bin/closewin, set execute permission with chmod, and it seems to work fine. I'm not sure how it would react if you had multiple windows open with the same directory name, though.
 
Back
Top