Opening mounted Volumes in Finder

I'd like to automatically open mounted Volumes in a Finder window. This is so connected devices like a camera or game console and storage like SD cards are more visible after I attach them.
Folder: /Volumes
Rule: Open Mounted Volume
- Do the following > Open > with application: Finder
This works, but it also displays volumes mounted by the system, such as my backup drive, Recovery partition, etc.
So I decided to add a shell script to exclude specific volumes:
Folder: /Volumes
Rule: Open Mounted Volume
- Passes shell script > embedded shell script
- Do the following > Open > with application: Finder
This script returns 1 for volumes to exclude, and 0 for volumes to match/pass. It counts matching lines using grep on diskutil info output.
This kind of works, but it's not satisfactory mostly due to the awkward way I need to exclude volumes.
Any suggestions how I can do this in a better way?
I'm using Hazel 4.4.5
Folder: /Volumes
Rule: Open Mounted Volume
- Do the following > Open > with application: Finder
This works, but it also displays volumes mounted by the system, such as my backup drive, Recovery partition, etc.
So I decided to add a shell script to exclude specific volumes:
Folder: /Volumes
Rule: Open Mounted Volume
- Passes shell script > embedded shell script
- Do the following > Open > with application: Finder
- Code: Select all
return $(( $(diskutil info "/Volumes/$1" | grep -e "Volume Name:\s*320GB" -e "Volume Name:\s*Tardis" -e "Volume Name:\s*External" | wc -l) ))
This script returns 1 for volumes to exclude, and 0 for volumes to match/pass. It counts matching lines using grep on diskutil info output.
This kind of works, but it's not satisfactory mostly due to the awkward way I need to exclude volumes.
Any suggestions how I can do this in a better way?
I'm using Hazel 4.4.5