Let’s say I have multiple files I want to delete, and they’re stored one per line in a files.txt file. I can delete them with
set deleteThis to paragraphs of (read "files.txt")
repeat with lineFromFile in deleteThis
set fileName to POSIX file lineFromFile
tell application "Finder" to delete file fileName
end repeat
This is the logic you usually find online — deleting them one by one, but not only does this screw your “Put Back” option (you have to ⌘z multiple times), it also plays the trash sound a bunch of times in a row.
Is there a way to delete multiple files at once, say via storing them in an array and deleting that?
Edit
The answer by @adayzdone is the best so far, but it fails on directories