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