0
我是一个完全在applescript中的新手,所以说.. 我想要做的是删除文件夹内的特定文件。例如:Applescript删除文件,该名称不包含“_s”
我有这样的文件:
- C9361WL_1.jpg
- C9361WL_1.jpg
- C9361WL_2.jpg
- C9361WL_3.jpg
- C9361WL_4.jpg
- C9361WL_1_s。 jpg
- C9361WL_2_s.jpg
- C9361WL_3_s.jpg
- C9361WL_4_s.jpg
我想删除不包含名称文件中 “_s” 的文件。
非常感谢您的帮助。
我在Automator中写的代码是:
on run {input, parameters}
repeat with this_file in input
if this_file does not contain "_s" then
delete this_file
end if
end repeat
return input
end run
仍然没有运气这个剧本,我已经做了一些变化
on run {input, parameters}
repeat with this_file in input
set thePath to POSIX file of this_file as alias
set delFiles to (every file of thePath whose name does not contain "_s")
tell application "Finder"
move files of delFiles to "/Users/dyohanan/Desktop/"
end tell
end repeat
return input
end run
您好vadian,感谢您的帮助。我做了你告诉我的,现在我收到一条错误消息,告诉我: 语法错误:“不能将第1项的名称写入类型引用” – Dan
该脚本假定“输入”是一个别名说明符列表。 – vadian
你是对的,当我测试只有一个项目而不是列表时出现错误。 但现在我没有收到错误,但脚本不会删除这些文件。 – Dan