向AppleScript脚本授予权限

向AppleScript脚本授予权限,applescript,Applescript,我有一个简单的AppleScript,它应该删除下载文件夹中的所有内容,但最后传递的选定文件夹列表除外 tell application "Finder" delete (every item of "Downloads" of folder currentUser of folder "Users" of startup disk whose name is not in {"PreciousFolder"

我有一个简单的AppleScript,它应该删除下载文件夹中的所有内容,但最后传递的选定文件夹列表除外

tell application "Finder"
    delete (every item of "Downloads" of folder currentUser of folder "Users" of startup disk whose name is not in {"PreciousFolder"})
end tell
保存时,AppleScript返回以下错误:


您将删除文本字符串
“Downloads”
中没有意义的每一项。添加
文件夹
说明符

tell application "Finder"
    delete (every item of folder "Downloads" of folder currentUser of folder "Users" of startup disk whose name is not in {"PreciousFolder"})
end tell
或更短

tell application "Finder"
    delete (every item of (path to downloads folder) whose name is not in {"PreciousFolder"})
end tell

在文件夹说明符中,我的目的是删除下载文件夹中的文件和文件夹,不包括PreciousFolder及其内容。在这种情况下我需要文件夹或文件说明符吗?
文件夹
说明符指的是下载文件夹,而不是其内容<代码>每个项目都考虑文件和文件夹。