tags:

views:

47

answers:

3

Hey,

I'm wondering if it is possible to restore a file that is in the trash (~/.Trash) to its original location.

I understand there is a restore command but I don't understand its arguments or how to correctly use it.

Is this a fairly simple thing to do?

Cheers

+1  A: 

.Trash is just a (hidden) directory. All you need to do is move it out:

mv ~/.Trash/foo ~/

or using the file browser of your desktop environment, open the trash and drag it out.

(And yes, this belongs on superuser, but hey, quick answers are nice.)

Jefromi
+1  A: 

As far as I know, in the trash folder (~/.local/share/Trash/), there is a folder with the files (files/) and a folder with the file information (info/). Each file has an associated .trashinfo file in which the original path and time of deletion are stored. You can use that to restore the file to its original location.

Wolf
What distribution (Ubuntu, Fedora, etc.) and desktop (KDE, Gnome, etc.) are you using? My system (RHEL 5 w/Gnome) has `.Trash` not `.local/share/Trash` and there are no `files/` and `info/` subdirectories. There is, in fact, no way to tell what the original location was.
Stephen P
Hmm, interesting. I'm using Xfce with Ubuntu, but I've seen it on Debian and Fedora systems too, not sure about the DE. Looks like my answer does not apply for this question then.
Wolf
+1  A: 

If your desktop environment followed the XDG Trash Can Specification when trashing the file, then restore-trash from trash-cli would do the trick.

What desktop do you use?

ephemient