【发布时间】:2015-09-11 22:07:50
【问题描述】:
我正在尝试创建一个脚本来删除同一文件夹中的多个文件,而无需进行两次身份验证。我已经尝试了很多东西,但我对 AppleScript 非常陌生,而且我一直在努力。非常感谢任何帮助。
set colorProfiles to (POSIX file "/Library/ColorSync/Profiles")
set coatedToDelete to "Pantone+ Solid Coated.csv"
set uncoatedToDelete to "Pantone+ Solid Uncoated.csv"
try
--Notification window with info
display dialog ("This script will automagically delete your outdated Pantone color books. Please make sure an admin is nearby to authenticate (twice) if prompted.") with icon note
--Deletes both Pantone+ .csv files
tell application "Finder"
delete file (coatedToDelete of folder colorProfiles)
delete file (uncoatedToDelete of folder colorProfiles)
end tell
--Successful deletion notification
display dialog ("The outdated color book deletion was successful!") buttons {"Great!"} with icon note
on error
--Error message notification
display dialog ("This script was unable to delete your legacy Pantone color books.") buttons {"OK"} with icon caution
end try
【问题讨论】:
标签: file applescript directory delete-file