rm -rf [file] command is very useful, but many times it is dangerous. Sometimes it would be nice to have a simple command that moves files to the trash. I created a Bash script that does just that.
Normally, if you would like to move a file to the trash, you would have to type the command:
mv [file] ~/.Trash. Not to mention, it is difficult to delete multiple files. Here is the the script I use to delete files to the trash easily:
I put this in a file called
trash and used the command
chmod 755 trash to make it executable. I then added it to my
$PATH. I now can use the command
trash [files] anywhere. I have only tested this on Mac OS X, but it should work on any Unix based system.