I am used to having rm to alias something safer.

I have been using osx-trash, but once I upgrade to Ruby 1.9.2, this stops working.

I know about trash-cli from Python, but I would much prefer something that moves files to the Trash folder in OS X rather than another directory.

Does anyone have a good solution?

link|improve this question

25% accept rate
6  
Please, don´t get used to an aliased rm, rather get used to mv files/to/be/deleted ~/.Trash. It´s safe and consistent across systems. – Asmus Jul 25 '11 at 6:45
Asmus: You see that only works if your mac has only 1 partition. If you have another partition, moving to ~/.Trash is not really correct (my ~ partition is not big enough). – disappearedng Jul 25 '11 at 9:03
1  
Well you should have mentioned in your question that you have multiple partitions! – slhck Jul 25 '11 at 11:41
disappearedng: well, I think mv is still your safest bet. You could easily create a new folder on your other partition called Trash (or however you like it) and then mv the files there. Once you´re sure they can be deleted, delete and recreate that complete folder. – Asmus Jul 26 '11 at 14:52
and then you can just have ~/.Trash be a soft link to the Trash folder on the partition that has enough space – Jon Rodriguez Jan 5 at 5:15
feedback

1 Answer

hasseg.org/trash: an Objective-C utility like osx-trash.


Use OS X's trash in a Finder-like way from Terminal - Mac OS X Hints: mactrash, a ~100 line shell script


trsh() {
    for f in "$@"; do
        bn="$(basename "$f")"
        while [ -e ~/.Trash/"$bn" ]; do
            bn="$bn $(date +%H.%M.%S %p)"
        done
        mv "$f" ~/.Trash/"$bn"
    done
}
  • Appends a date to the names of existing files
  • Always moves files to the boot volume's trash though
link|improve this answer
Yeah I have more than 1 partition and I would want to keep the deleted files in the same partition rather than moving them across – disappearedng Jul 25 '11 at 9:03
I added links to two other utilities and another function. Each of them should keep the files on the same partition. – Lri Jul 25 '11 at 22:56
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.