我用Automator创建了一个macOS服务,它实际上会将Finder中的每个文件附加到一个新的Thunderbird撰写窗口,并且只是一个简单的bash脚本。如何检测文件是否是macOS上bash脚本中的文件夹?
for f in "[email protected]"
do
open -a /Applications/Thunderbird.app/ "$f"
done
此服务还可以用于任何文件夹,但肯定无法将文件夹附加到撰写窗口。但我现在的想法是让脚本检测文件是文档还是文件夹。如果它是一个文件,请附上它。如果它是一个文件夹,首先压缩它并附加它。在方式:
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
但我怎么检测,如果该文件是一个文件夹,压缩比它在bash脚本的zip文件?
请参阅:'help test | less' – Cyrus