Delete Files (Without The Trash Noise)


Here's another bit of code that I picked up somewhere... If you are working with files and you'd like to delete them without triggering that "Move to Trash" noise, you can utilize AppleScript's shell scripting module to delete the files with a Terminal command. To do so, just send the files through this subroutine.

The Code

on file_Delete(completed_Files)
    repeat with completed_file in completed_Files
        set trash_Folder to path to trash folder from user domain
        set trash_File to completed_file as text
        do shell script "mv " & quoted form of POSIX path of trash_File & space & quoted form of POSIX path of trash_Folder
    end repeat
end file_Delete