利用Automator创建脚本。
选择服务类型并找到run shell script。
做如下设置:
- 将““服务”收到选定的”一栏选择:“文件或文件夹”;
- “传递参数”一栏选择:“自变量”。
然后键入以下:
for f in "$@"
do
if test -d "$f"
then
rm -r "$f"
else
rm "$f"
fi
done确定保存即可。
本文介绍如何通过Mac上的Automator应用创建一个简单的服务,该服务可以接收选定的文件或文件夹作为输入,并批量删除这些文件或文件夹。具体实现方式是通过运行shell脚本来完成。文中提供了具体的shell脚本代码。
利用Automator创建脚本。
选择服务类型并找到run shell script。
做如下设置:
然后键入以下:
for f in "$@"
do
if test -d "$f"
then
rm -r "$f"
else
rm "$f"
fi
done
558
1万+

被折叠的 条评论
为什么被折叠?