Skip to content

Instantly share code, notes, and snippets.

@iwill
Created July 24, 2013 15:47
Show Gist options
  • Save iwill/6071812 to your computer and use it in GitHub Desktop.
Save iwill/6071812 to your computer and use it in GitHub Desktop.
move files to trash
#! /bin/bash
# http://hints.macworld.com/article.php?story=20091003083125659
function trash() {
for arg in "$@"; do
if [ -e "$PWD/$arg" ]; then
osascript -e "tell application \"Finder\" to delete POSIX file \"$PWD/$arg\"" &>/dev/null
elif [ -e "$arg" ]; then
osascript -e "tell application \"Finder\" to delete POSIX file \"$arg\"" &>/dev/null
else
echo File not found
fi
done
}
alias del="trash"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment