Skip to content

Instantly share code, notes, and snippets.

@aqualungdesign
Created January 23, 2013 20:19
Show Gist options
  • Save aqualungdesign/4612606 to your computer and use it in GitHub Desktop.
Save aqualungdesign/4612606 to your computer and use it in GitHub Desktop.
iterm / oh-my-zsh -> rm move to .trash
#add script to .oh-my-zsh/lib/functions.zsh
function rm () {
local path
for path in "$@"; do
# ignore any arguments
if [[ "$path" = -* ]]; then :
else
local dst=${path##*/}
# append the time if necessary
while [ -e ~/.Trash/"$dst" ]; do
dst="$dst "$(date +%H-%M-%S)
done
/bin/mv "$path" ~/.Trash/"$dst"
fi
done
}
@julianpinedayyz
Copy link

this works better than npm trash! Thanks! Added to my .zshrc file and worked like a charm ;)

@pan-long
Copy link

pan-long commented Apr 6, 2016

I actually choose a package here for Mac OSX https://github.com/ali-rantakari/trash as it calls finder's API and supports "put back" function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment