Skip to content
Manipulates the Mac OS X trash from the command line, just like the Finder does. (Mirror. Doesn't work yet.)
Shell Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
bin
lib/osxtrash
rubyforge
.gitignore
CHANGES
COPYING
README.rdoc
Rakefile

README.rdoc

Overview

osx-trash is a command line program called trash to manipulate the trash on Mac OS X. It uses AppleScript via Scripting Bridge on top of RubyCocoa to manipulate the trash, just like the Finder does. Here's a simple example:

% touch foo bar baz
% trash -l
% trash foo ba*
% trash -l
/Users/dave/.Trash/foo
/Users/dave/.Trash/bar
/Users/dave/.Trash/baz
% trash -e
% trash -l

Using Finder's AppleScript has a number of benefits compared to shell scripts that just move files to ~/.Trash. First, it creates unique names when there are collisions:

% touch foo
% trash foo
% touch foo
% trash foo
% trash -l
/Users/dave/.Trash/foo
/Users/dave/.Trash/foo 20-38-20

It also handles trashes on different volumes properly:

% touch foo
% trash foo
% touch /Volumes/DiskImage/bar
% trash /Volumes/DiskImage/bar
% trash -l
/Users/dave/.Trash/foo
/Volumes/DiskImage/.Trashes/501/bar

Links

Something went wrong with that request. Please try again.