Windows 10, Emacs 25.1

In my init.el I set:

delete-by-moving-to-trash t

So as result when I delete file it move to trash. Nice. But how I restore delete file from trash by Emacs?

  • Looking through a copy of the emacs source from git, there doesn't appear to be a way to do what you want. You can probably navigate to the trash folder and move files back manually. – Realraptor Dec 14 '17 at 15:53
  • What are you mean "navigate to trash"? Using external program? – Alex Dec 14 '17 at 15:58
  • This might answer to your request ;-) github.com/shingo256/trashed – Shingo Tanaka Nov 8 '19 at 13:13

I don't use trash, so this is a bit of a guess. And I don't find anything about restoring trashed files in the Emacs or Elisp manuals. You might want to just check your system docs for info about restoring from your system trash can.


First, customize option trash-directory, if you have not already. Thereafter, trashed files will be put in that directory.

To restore a file that has been trashed there, use C-x d to open Dired on that directory, then use R to move one or more trashed files to another directory. R moves all marked files (or just the file of the current line, if none are marked). At the prompt, type the name of the target directory.

If you have not set option trash-directory then files get trashed to your system recycle bin (trash can), provided function system-move-file-to-trash is defined.

In that case, use C-x d to open your system trash folder (it may be $trash/files).

However, See https://specifications.freedesktop.org/trash-spec/trashspec-latest.html for information about the kind of trash can that is used by default, and how to obtain the original file name of a trashed file.

| improve this answer | |

You can use Trashed in MELPA. This package provides you a simple but convenient user interface to manage trashed files. It supports both MS Windows Recycle Bin and freedesktop.org Trash Can. See https://github.com/shingo256/trashed

| improve this answer | |

Your Answer

