Last active
October 2, 2022 16:34
-
-
Save RhetTbull/a528c6d99a161a2eabce8afb5c56c52a to your computer and use it in GitHub Desktop.
Simple shell script to open the macOS Finder's "Info Window" for a file or folder from command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Simple script to open the macOS Finder's "Info Window" for a file or folder. | |
# Usage: finfo [file or folder] | |
# This relies on realpath being installed (brew install coreutils) | |
if [ -z "$1" ]; then | |
echo "Usage: finfo [file or folder]" | |
exit 1 | |
fi | |
fpath=$(/usr/local/bin/realpath $1) # Get the full path to the file | |
osascript \ | |
-e "set aFile to (POSIX file \"$fpath\") as alias" \ | |
-e "tell application \"Finder\" to open information window of aFile" \ | |
-e "tell application \"Finder\" to activate" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment