#!/usr/bin/env ruby
# 'rm' replacement that integrates with OS X Trash
# To install: save as ~/bin/rm, make executable, and put ~/bin/rm first in your PATH
#
# Copyright (c) Michael Keirnan
# Disclaimer: Provided as-is, no warranty, may work, may not, be careful, don't run with scissors, etc.
require 'fileutils'
now = Time.now
dir = File.expand_path("~/.Trash") + "/rm-#{now.strftime('%Y-%m-%d-%H')}-#{rand(1000000)}"
Dir.mkdir(dir)
ARGV.each do |f|
if File.symlink?(f)
puts "removing symlink"
FileUtils::Verbose.rm(f)
end
if File.exist?(f)
FileUtils::
Verbose.mv(f, dir)
end
end