#!/usr/bin/env bash # Move one or more files to the Trash in macOS. # # Examples: # # trash ~/Desktop/cat.jpg # Trash a single file # trash ~/Desktop/photos # Trash a folder # trash dog.png fish.gif # Trash multiple files at once # osascript -e 'on run argv repeat with filePath in argv set posixPath to (POSIX file filePath) tell application "Finder" if posixPath exists log filePath delete posixPath end if end tell end repeat end run' "$@" 2>&1 1>/dev/null