2009
08.22

Well… This may not be “the news” for most of you, but I figured this out just yesterday:

For a long time I suffered deleting files while working on command line and then figured that I needed them just in a moment. This was a real pain in the neck back then. Eventually someday, I found a nice perl script in the wild, which would create a tarball of what I wanted to delete and then move it to the ~/.Trash instead of actually removing from the system, so I could restore it from the trash (automagically into the desktop) just in case.

This solution worked pretty nice for a very long time now, but that doesn’t cut anymore, because of the freedesktop specification thing about how the trash should work, or maybe just because the way that GNOME handles this. In anycase I needed a better solution:

  • You delete the file(s)
  • File(s) goes to trash (just like when you delete via UI)
  • You can either empty trash at once, or restore every single remove from the trash just with simple clicks (into the original path where you actually deleted things)

Now this is possibile! There’s a command called gvfs-trash (I believe stands for gnome virtual filesystem trash), which will take whatever you wanted to delete (either single files or an entire folder) and put it into the trash in GNOME UI way of doing this. You can alias rm='gvfs-trash' if you don’t wanna make terrible mistakes, even if gvfs-trash can’t actually replace it, because these two have completely different usages.

No Comment.

Add Your Comment

Comments are closed.