0

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?

migrated from stackoverflow.com Oct 12 '12 at 10:50

This question came from our site for professional and enthusiast programmers.

1

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.

  • 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 Oct 28 '10 at 20:57
  • 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 Oct 28 '10 at 20:59
1

.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.

1

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

0

There are 2 ways recover files from trash mac for free by yourself:

1) The screenshot shows how to "undelete" a file. It will be moved back.

enter image description here

If you simply put files in the Trash you can restore them by opening the Trash (left-click on the Trash icon) and drag the files from the Trash to your Desktop or other desired location.

2) "Time machine" is a built-in backup tool that works with your Mac and an external drive, As the problem you described, I read it. The files deleted in Trash bin could be a different problem which Time machine can't solve. You can read this article and learn more. I hope it will help.

If you emptied the trash, the deleted file is still being recovered because you delete a file, the file itself still remains on the drive, the thing you “deleted” is just the space of it.

The computer operating system is just free up the space of this file so that the new file can be put on the drive.

So remember this, after file deletion is happened, don’t put any new files on the drive which the lost files were stored before ’cause this will lead to data overwritten situation. Once this happens, you will lose the chance for lost file rescue.

If you stop using the drive it's possible to recover deleted files that have not been overwritten by using recovery software such as uFlysoft.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy