Terminal 带终端的Applescript查找和删除文件夹
因此,我想尝试制作一个脚本,用applescript查找并删除文件夹中的多个文件夹:Terminal 带终端的Applescript查找和删除文件夹,terminal,applescript,Terminal,Applescript,因此,我想尝试制作一个脚本,用applescript查找并删除文件夹中的多个文件夹: tell application "Terminal" activate do script "find (Path to folder) -type d *-name "Foldername*" -exec rm -rf {} \;*" end tell Applescript不会在类型d之后运行任何东西,因为“Syntaxerror expected end of row”,但我不明白为
tell application "Terminal"
activate
do script "find (Path to folder) -type d *-name "Foldername*" -exec rm -rf {} \;*"
end tell
Applescript不会在类型d之后运行任何东西,因为“Syntaxerror expected end of row”,但我不明白为什么,因为如果我运行
find (Path to folder) -type d *-name "Foldername*" -exec rm -rf {} \;*
在终端中,您可以使用命令
do shell script
,该命令的作用与在终端中运行它相同。您不需要tell
块来运行此操作
这里还有两点需要在脚本中查看
“
引号,则需要使用\
对其进行转义。
i、 e.“一些脚本\”一些名字\“更多脚本”
。
否则,只需在双引号脚本中使用单引号\
是run,则需要在Applescript中转义它。
i、 e.rm-rf{}\\\;*“
do shell script "find (Path to folder) -type d *-name 'Foldername*' -exec rm -rf {} \\;*"
您为什么不使用
do shell脚本
命令?