Ever wished you could move files to the trash from the command line on the Mac? Here’s how.
First, buy a Mac. Then
Option 1 (uses bash): add the following to your
source ~/.bash_profile in Terminal.
Or Option 2 (uses Python and gives slightly more meaningful error messages): make an executable file called
rem somewhere in your
Now, either way, to move
blah.txt to Trash, simply type
rem blah.txt. Wildcards and lists of files are permitted. You even get the sound effects!
(This makes use of Applescript and works for me on OS X Tiger and Leopard. Thanks to kw for pointing out the problem with Option 1 and leading me to think of an alternative - 3 July 2008. And thanks for icke for showing me how to make the bash version work all the time - 6 Nov 2008.)