I have created a macOS Service with Automator which actually will attach every file from the Finder to a new Thunderbird compose window and is just a simple bash script.
for f in "$@"
do
open -a /Applications/Thunderbird.app/ "$f"
done
This Service also would work for any folder, but for sure you can not attach a folder to a compose window. But my idea is now to let the script detect if the file is a document or a folder. If it is a document, attach it. If it is a folder, first zip compress it and than attach it. In the way:
if file is folder than
// zip compress folder
// attach *.zip to Thunderbird compose window
else // seems to be a document
// attach document to Thunderbird compose window
But how do I detect if the file is a folder and than compress it as zip file in the bash script?